ios - NSDateFormatter: error in converting date -
i have got following time stamp in milliseconds: nsdate * date = [nsdate datewithtimeintervalsince1970:1470524933.923123]; nsdate * date2 = [nsdate datewithtimeintervalsince1970:1470666561.000]; nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss"]; nsstring * dateinstring = [dateformatter stringfromdate:date]; when run following: 2016-08-07 @ 00:08:53 , 2016-08-08 @ 15:29:21 however first date should following according epoch time converter website using : your time zone: 8/7/2016, 12:08:53 gmt+1:00 dst it says 00 rather 12. why that? try set timezone of nsdateformatter gmt [dateformatter settimezone:[nstimezone timezonewithabbreviation:@"gmt"]]; as larme , vadian suggested if want 12 hour use format [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss a"];