iOS 日期格式的转换
生活随笔
收集整理的這篇文章主要介紹了
iOS 日期格式的转换
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
更改“2011-12-09T14:58:36+08:00”格式的日期 ?
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];[dateFormatter setLocale:[[[NSLocale alloc]initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate *dateTime = nil;
[dateFormatter getObjectValue:&dateTime forString:pubTime range:nil error:nil];
[dateFormatter setDateFormat:@"yyyy年MM月dd日 HH:mm:ss"];
[lblPubTime setText:[dateFormatter stringFromDate:dateTime]];
[lblPubTime setFrame:CGRectMake(10, startYLoc, 120, 15)];
[dateFormatter release];
總結
以上是生活随笔為你收集整理的iOS 日期格式的转换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 深入研究虚幻4反射系统实现原理(一)
- 下一篇: DotNet4应用程序打包工具(把Dot