You must pass the time string to the client in standard form, for example, ISO8601:
var timeString = '2012-01-02T16:00:00Z';
Some browsers will correctly parse ISO8601 lines, and some will not, so analyze it manually to be sure. It's quite simple - create a local date object, then set the UTC date and time:
function localDateFromUTC(s) { var x = s.split(/[-\s:tz]/i); var d = new Date(); d.setUTCFullYear(x[0], x[1], x[2]); d.setUTCHours(x[3], x[4], x[5]); return d; } var s = '2012-01-02T16:00:00Z'; var d = localDateFromUTC(s); alert(d);
If you need a specific output, you need to format it manually, for example.
function formatDate(d) { var days = ['Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday']; var months = ['January','February','March','April','May','June','July', 'August','September','October','November','December']; return days[d.getDay()] + ', ' + d.getDate() + ' ' + months[d.getMonth()] + ', ' + d.getFullYear(); }
You can try using toLocaleString (), but the results in different browsers vary greatly, most of them tend to ignore local settings.