Muhamméd Muhamméd - 6 months ago 55
iOS Question

Get time (GMT) from 1970 by seconds in swift

I just need to get the (GMT) time by seconds from 1970

i found this method

NSDate().timeIntervalSince1970


but its return the time depends on device time not ( GMT ) time

Answer

According to the documentation, it does exactly what you want (UTC is equivalent to GMT in this scope):

The interval between the date object and 00:00:00 UTC on 1 January 1970

NSDate represents an instant in time and is independent of time zones:

NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone

Time zones are only used to print the instant in time as a human readable string

Comments