Convert NSTimeInterval to NSString in iPhone?

后端 未结 2 712
广开言路
广开言路 2021-02-02 08:22

How to covert the NSTimeInterval to NSString? I have

NSTimeInterval  today = [[NSDate date] timeIntervalSince1970];

I have to give \"today\" a

2条回答
  •  温柔的废话
    2021-02-02 09:07

    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];
    

提交回复
热议问题