ios - Date Formatting is Weird -


i have date string looks this:

1391640679661 

when use code:

nsstring *seconds = @"1391640679661"; nsdate *date = [nsdate datewithtimeintervalsince1970:[seconds doublevalue]]; 

i end this:

46069-05-03 07:27:41 +0000 

so what's happening here? particular date format i'm not accounting for? or doing else wrong?

to convert timestamp string nsdate, need divid timestamp double value 1000, , call datewithtimeintervalsince1970:

nsstring *timestamp = @"1391640679661"; double seconds = [timestamp doublevalue]/1000.0; nsdate *date = [nsdate datewithtimeintervalsince1970:seconds]; 

the result is:

2014-02-05 22:51:19 +0000


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -