0

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

  • 1
    You haven't shown any code or data. But most probably it is a duplicate of [Getting date from NSDate date off by a few hours](http://stackoverflow.com/questions/8466744/getting-date-from-nsdate-date-off-by-a-few-hours) (which is #1 in the "frequent" section of [nsdate]). – Martin R Jul 03 '15 at 14:24
  • CODE: let date = NSDate(); println(date) OUTPUT: 2015-07-03 14:33:02 +0000 – Mohammad Yaqoob Jul 03 '15 at 14:46

1 Answers1

0

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))
Rob
  • 415,655
  • 72
  • 787
  • 1,044