In objective-c, the following code results in the UTC date time information using the
date
NSDate *currentUTCDate = [NSDate date]
let date = NSDate.date()
date
NSDate
NSDate
NSDateFormatter
The documentation says that the date
method returns a new date set to the current date and time regardless of the language used.
The issue probably sits somewhere where you present the date using NSDateFormatter
. NSDate
is just a point on a time line. There is no time zones when talking about NSDate
. I made a test.
print(NSDate.date())
After latest updates, the new syntax is:
print(NSDate())
Output: 2014-07-23 17:56:45 +0000
NSLog(@"%@", [NSDate date]);
Output: 2014-07-23 17:58:15 +0000
Result - No difference.