Sat*_*Sat 0 cocoa-touch objective-c ios
我有一个NSStirng包含2013-01-08 07:52:00 +0000.我想把日期和时间分开来NSStrings.
任何帮助表示赞赏.
服务器的格式是否一致?
您是否需要使用日期和时间进行排序等任何操作......或者是为了添加时间还是只是显示它们?
如果您只是显示它们并且字符串的格式不会改变那么您可以这样做......
//assumption 1: the format is <date>space<time>space<timezone>
//assumption 2: the only purpose is to display the values sent from the server.
NSString *dateString = @"2013-01-08 07:52:00 +0000";
NSArray *components = [dateString componentsSeparatedByString:@" "];
NSString *date = components[0];
NSString *time = components[1];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2865 次 |
| 最近记录: |