I am trying to format the time as follows:
let formatter = NSDateFormatter() formatter.dateFormat = "hh_mm_ss" let d = formatter.stringFromDate(NSDate()) println("formatted text is: \(d)")
Suppose the current time is September 3, 2014 10:15:30 p.m.
- When I run this script on the playground, it prints a correctly formatted time:
22_15_30 . - When you run this AppDelegate application, it does not print a formatted time:
22:15:30
I am using xcode 6 beta 5 ... Am I missing something? Why doesn't stringFromDate return the correct date in format?
EDIT : I am using xcode 6 beta 6.
Thanks!
ios swift nsdate nsdateformatter
Angel jonathan
source share