# UNIX time from a JSON feed to DateTime Tag

**URL:** <https://forum.inductiveautomation.com/t/unix-time-from-a-json-feed-to-datetime-tag/9988>\
**Category:** Ignition\
**Created:** [May 6, 2015, 10:30pm UTC](https://forum.inductiveautomation.com/t/unix-time-from-a-json-feed-to-datetime-tag/9988 "2015-05-06T22:30:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DuctSoup](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@DuctSoup](https://forum.inductiveautomation.com/u/DuctSoup)\
**Post date:** [May 6, 2015, 10:30pm UTC](https://forum.inductiveautomation.com/t/unix-time-from-a-json-feed-to-datetime-tag/9988/1 "2015-05-06T22:30:09Z")

</div>

Hi,

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/](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]

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [May 6, 2015, 10:53pm UTC](https://forum.inductiveautomation.com/t/unix-time-from-a-json-feed-to-datetime-tag/9988/2 "2015-05-06T22:53:49Z")

</div>

Multiple the value by 1000

[code]from java.util import Date

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

---

<div class="post-metadata">

**Author:** ![DuctSoup](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@DuctSoup](https://forum.inductiveautomation.com/u/DuctSoup)\
**Post date:** [May 6, 2015, 11:06pm UTC](https://forum.inductiveautomation.com/t/unix-time-from-a-json-feed-to-datetime-tag/9988/3 "2015-05-06T23:06:57Z")

</div>

I’m a idiot, thanks!

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