Ios-nsdate himself to dig a hole and jump himself

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.