开发者

Get actual date into seconds on iOS SDK

I'm making an app where I need to get the actual date ([NSDate date开发者_JAVA技巧]) into seconds since 1970 (timeIntervalSince1970). But I don't manage to get it working, how should it be done?


NSTimeInterval seconds = [[NSDate date] timeIntervalSince1970]

Note that NSTimeInterval is actually a double value, not an object.


double intrval=[[NSDate date] timeIntervalSince1970];

-(NSDate*)dateFromDouble:(double) intrval{
    return [NSDate dateWithTimeIntervalSince1970:intrval];  
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜