ios - Epoch Unix Time Missing Few hours when the year is before 1970 -



ios - Epoch Unix Time Missing Few hours when the year is before 1970 -

i have web service returns date of birth of people. issue having when year of birth around 1899 time looses few hours. however, more close gets 1970 gets accurate. there no issues when birth year after 1970.

passed date - 1899-12-31 16:00:00 +0000

returning date - 1899-12-31 22:55:25 +0000 (added time difference of +0800)

after 1970 fine]

passed date - 1990-08-24 16:00:00 +0000

returning date - 1990-08-25 00:00:00 +0000

im using objective c

jsondatestring passing string

double datenumber = [[jsondatestring substringwithrange:nsmakerange(startposition, 1)] isequaltostring:@"-"] ? - [[jsondatestring substringwithrange:nsmakerange(startposition + 1, 13)] doublevalue] : [[jsondatestring substringwithrange:nsmakerange(startposition, 13)] doublevalue]; nstimeinterval unixtime = datenumber / 1000; //wcf send 13 digit-long value time interval since 1970 (millisecond precision) whereas ios works 10 digit-long values (second precision), hence split 1000 // time changes***** - ashan nsdate *gmtdate = [[nsdate datewithtimeintervalsince1970:unixtime]datebyaddingtimeinterval:0]; nstimeinterval timezoneoffset = [[nstimezone systemtimezone] secondsfromgmtfordate:gmtdate]; nsdate *localdate = [gmtdate datebyaddingtimeinterval:timezoneoffset];

jsonstring - /date(-2209017600000+0800)/

dividedby1000 : -2209017600.000000

passed date - 1899-12-31 16:00:00 +0000

returning date - 1899-12-31 22:55:25 +0000

as can see convert time stamp , says 1600 , +8 0000. how ever shows 1100h. issue epoch unix timing before 1970 or db issue on server side.

ios iphone ios7 epoch

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -