javascript - timeSpan date pc VS device -
i have simple code of date in as3:
var currdate:date = new date(number(461624400000)); trace("currdate= "+currdate);
when run code on pc date:
sat aug 18 00:00:00 gmt+0300 1984
when run code on device date:
fri aug 17 23:00:00 gmt+0200 1984
a 1 day difference.
that happens particular date
when try running similar code javascript, got difference when running on pc , device. here code:
console.log(new date(461624400000));
i happy if me. thanks.
you can use code both as3 , js, date set epoch, hence results identical both platforms.
var utcseconds = 461624400000; var date = new date(0); // 0 sets date epoch date.setutcseconds(utcseconds); trace (date); //alert (date)
example timezone shifting:
function timestampdate(value) { return new date(new date(value).gettime() + (new date().gettimezoneoffset() * 60 * 1000)); }; var timestamp = 461624400000; date = timestampdate(timestamp); alert (date);
you'll identical hour, minute, second different timezone though
Comments
Post a Comment