Nsdate:5 is a pit ah Ah!
1NSDateFormatter *dateformatter =[[NSDateFormatter alloc] init];2 3[Dateformatter Setdateformat:@"YYYY/MM/DD Hh:mm:ss"];4 5NSLog (@"0:%@", [dateformatter stringfromdate:[nsdate Date]]);6 7 8 9 [Dateformatter settimezone:[nstimezone systemtimezone];Ten OneNSLog (@"1:%@", [dateformatter stringfromdate:[nsdate Date]]); A - - the [Dateformatter settimezone:[nstimezone defaulttimezone]; - -NSLog (@"2:%@", [dateformatter stringfromdate:[nsdate Date]]); - + - + [Dateformatter settimezone:[nstimezone localtimezone]; A atNSLog (@"3:%@", [dateformatter stringfromdate:[nsdate Date]]); - - - -[Dateformatter settimezone:[nstimezone Timezonewithname:@"Asia/shanghai"]]; - inNSLog (@"4:%@", [dateformatter stringfromdate:[nsdate Date]]); - to + -[Dateformatter Settimezone:[[nstimezone alloc] Initwithname:@"Asia/shanghai"]]; the *NSLog (@"5:%@", [dateformatter datefromstring:[dateformatter stringfromdate:[nsdate Date]]); $ Panax Notoginseng
0:2015/02/03 09:41:14
1:2015/02/03 09:41:14
2:2015/02/03 09:41:14
3:2015/02/03 09:41:14
4:2015/02/03 09:41:14
5:2015-02-03 01:41:14 +0000
Included nsdate details Link: http://www.cnblogs.com/ios-wmm/archive/2013/04/21/3034204.html
Ios-nsdate himself to dig a hole and jump himself