date - Convert MySQL Timestamp to Local Time in Javascript -
i've seen few questions this, none seem universal solution browsers.
on webpage i'm fetching mysql timestamp 'yyyy-mm-dd hh:mm:ss' in utc. however, need convert timestamp in javascript display time in local meridian format... (i.e.. 8:00 pm).
the closest solution found appending 'utc' mysql timstamp string , creating date object that. however, solution doesn't work in safari. in anyone's knows of solution please allow me know.
thank in advance.
converting mysql timestamp
date
object in js , using gettimezoneoffset()
valid way it. according ecmascript specification date
should : yyyy-mm-ddthh:mm:ss
, should format date correctly ( string replace(' ', 't')
)
if still not working, list of date formats working across browsers described here
var d = new date(2011, 01, 07); var d = new date(2011, 01, 07, 11, 05, 00); var d = new date("02/07/2011"); var d = new date("02/07/2011 11:05:00"); var d = new date(1297076700000); var d = new date("mon feb 07 2011 11:05:00 gmt");
javascript date datetime datejs
No comments:
Post a Comment