开发者

Omit GMT from a NSDate

I am getting the current time using these code.

NSTimeInterval timeInterval = [moviePlayer currentPlaybackTime];
N开发者_JAVA技巧SDate *currentTime = [NSDate dateWithTimeIntervalSince1970:timeInterval];

Using a date formatter I print this. It prints the following.

1970-01-01 05:30:12 +0530

However the time is printed as 05:30 because of the time zone I think. Acutall I need this to be 00:00. How to format my date like that. It has to be 1970-01-01 00:00:12 +000.

Thank you


Set the date formatter's time zone to GMT:

[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜