UNIX time from a JSON feed to DateTime Tag


I’m pulling a JSON feed into Ignition with some considerable success but I’m having trouble getting the timestamps right. Can anyone point me in a good direction?

TIA, Craig

[code]#APIKey = “YourAPIKeyGoesHere”
#LatLon = “YourLatLonGoesHere”
json = system.net.httpGet(“https://api.forecast.io/forecast/” + APIKey + “/” + LatLon)
res = system.util.jsonDecode(json)

String tag

system.tag.write(“sTime”, res[“currently”][“time”])

result 1430950132

DateTime tag

system.tag.write(“dTime”, res[“currently”][“time”])

result 1970-01-17 8:29:10 AM

want something more like Wed, 06 May 2015 22:08:52 GMT[/code]

Multiple the value by 1000

[code]from java.util import Date

ms = 1430950132
print Date(ms * 1000)[/code]

I’m a idiot, thanks!

system.tag.write("dTime", int(res["currently"]["time"])*1000)