在iPhone中将NSTimeInterval转换为NSString? [英] Convert NSTimeInterval to NSString in iPhone?
本文介绍了在iPhone中将NSTimeInterval转换为NSString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将NSTimeInterval转换为NSString?我有
How to covert the NSTimeInterval to NSString? I have
NSTimeInterval today = [[NSDate date] timeIntervalSince1970];
我必须输入今天作为NSString的输入。
I have to give "today" as input as NSString.
推荐答案
NSTimeInterval只是一个双重类型,所以你可以使用+ stringWithFormat将它转换为字符串:方法
NSTimeInterval is just a double type so you can convert it to string using +stringWithFormat: method
NSTimeInterval today = [[NSDate date] timeIntervalSince1970];
NSString *intervalString = [NSString stringWithFormat:@"%f", today];
这篇关于在iPhone中将NSTimeInterval转换为NSString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文