开发者

NSGregorianCalendar to NSCalendar

I'm searching for a technique/method that can transform NSGregorianCalendar into a timestamp. I can make a double timestamp but not a integer timestamp

Here's my code:

//Create the timestamp of the date
NSTimeInterval timeSt开发者_JAVA百科amp = [[NSDate date] timeIntervalSince1970];
// NSTimeInterval is defined as double
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
NSLog(@"%@", timeStampObj);

But it gives me a timestamp of the type 1311780128.540395 And I want just 1311780128

Thanks to help me


If you just want the integer portion, cast the double to an int:

NSNumber *timeStampObj = [NSNumber numberWithInt: (int)timeStamp];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜