How do I solve this issue? I'm storing NSDate() in a variable for my StepPedometer App.
CODE: let date = NSDate(); println(date) OUTPUT: 2015-07-03 14:33:02 +0000
How do I solve this issue? I'm storing NSDate() in a variable for my StepPedometer App.
CODE: let date = NSDate(); println(date) OUTPUT: 2015-07-03 14:33:02 +0000
When you NSLog
a NSDate
object, it will show it to you in GMT/UTC. That's what the +0000
means. If you want to see it in your local time zone, use NSDateFormatter
:
let date = NSDate()
let formatter = NSDateFormatter()
formatter.dateStyle = .MediumStyle
formatter.timeStyle = .MediumStyle
println(formatter.stringFromDate(date))