简体   繁体   中英

How to format NSDateFormatter for this date

How would I format a NSDateFormatter to create a date from the following format?

Sat May 16 13:45:36 2015

The part of Sat May 16 is the part that I am unsure how to do

I know the last part would be HH:mm:ss yyyy

let dateString = "Sat May 16 13:45:36 2015"
let df = NSDateFormatter()
df.dateFormat = "E MMM dd HH:mm:ss yyyy"
df.dateFromString(dateString)   // "May 16, 2015, 1:45 PM"

You should take a look at this answer also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM