json - Epoch Time (Ticks since 1970) - Mac vs. Windows -
i have c# web services return json. .net javascriptserializer returns dates in epoch time (milliseconds since 1970). on windows machine, web based application processes milliseconds proper date without problem.
on mac, dates off 1 hour. not every time. sometimes. happening on iphone front end i'm building well.
i thought @ first had lost precision when dividing milliseconds 1000 create valid objective-c nsdate object. tested date creation in javascript on mac firefox same timestamp , got same 1 hour offset.
any ideas? thanks...
edit: noticed in console in xcode date created had -4 or -5 next it. i'm assuming gmt offset. seem vary independent of whether or not date offset 1 hour. -4 dates , -5 dates correct , of either 1 offset.
edit: examples using:
console.log(new date(-1173643200000));
returns sun oct 23 1932 00:00:00 gmt-0400 (est)
console.log(new date(-1031515200000));
returns sat apr 24 1937 23:00:00 gmt-0500 (est)
nsdate* date = [nsdate datewithtimeintervalsince1970:ticks / 1000]; -589320000000 = 1951-04-30 00:00:00 -0400 -1173643200000 = 1932-10-22 23:00:00 -0500
(this 1 returns correct in firebug console, wrong in xcode console)
-1303416000000 = 1928-09-12 00:00:00 -0400 -1492545600000 = 1922-09-15 00:00:00 -0400 -1263668400000 = 1929-12-16 00:00:00 -0500 -1252094400000 = 1930-04-29 00:00:00 -0400 -1046458800000 = 1936-11-03 00:00:00 -0500 -1298746800000 = 1928-11-05 00:00:00 -0500 -1031515200000 = 1937-04-24 23:00:00 -0500
(returns wrong in both firebug console , xcode console)
-910465200000 = 1941-02-24 00:00:00 -0500 -1152648000000 = 1933-06-23 00:00:00 -0400 -1109793600000 = 1934-10-31 23:00:00 -0500
is possible microsoft/mozilla/apple have conflicting rules defining when daylight saving time started then?
edit: mac firefox , windows firefox different results -1031515200000. both machines set same timezone.
my guess platform differences regarding when dst ends , begins. timestamps current years coming out right?
Comments
Post a Comment