4thSpace 4thSpace - 2 years ago 397
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download