4thSpace 4thSpace - 7 months ago 198
Swift Question

What time/day format is openweathermap.org list.dt using

I'm using the day forecast api at http://openweathermap.org/forecast16. There is a parameter called list.dt. It gives a value in this format: 1406080800.

What format is that and how would I translate it to some human readable using functionality in Swift?

Answer

The date is most likely in unix time (see forecast5, which states that list.dt is the "Time of data forecasted, unix, UTC".

Using Swift, you can use NSDate(timeIntervalSince1970: dt) in order to convert this to a date. Then you can use standard NSDateFormatter to make it human readable.