Hello All -
Brain-wracking issue here.
I've got a PHP-generated UNIX timestamp that I feed to a javascript function. This function then formats and displays the date to the user.
For example, the timestamp 1335024000 equals April 22, 2012 - 12:00:00 am - 00:00 and the javascript function I wrote spits out "22 Apr". Perfect.
That is, it's perfect for users in my timezone (Manila, Philippines).
If the user is in New York City, (I've tested this by re-setting the timezone on my computer to (UTC-05:00) Eastern Time) the php time stamp stays the same, but Javascript spits out "21 Apr". Arg!
Here's my javascript code:
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var stamp = 1335024000;
var a = new Date(stamp*1000);
var date = a.getDate();
var month = months[a.getMonth()];
I've investigated getTimezoneOffset() and, it does give a -5 hour offset from UTC, but I don't understand how to alter my code to accommodate this offset.
Will getTimezoneOffset() correct this issue? If not, how does one deal with this issue?
All guidance greatly appreciated.
alert(date + ' ' + month);
Okay, so javascript is doing something based upon the users timezone settings.
I've studied