# How to extract Unix timestamp from tag read?

**URL:** <https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 18, 2022, 10:10pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925 "2022-06-18T22:10:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wbaker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wbaker/32/85315_2.png) [@wbaker](https://forum.inductiveautomation.com/u/wbaker)\
**Post date:** [June 18, 2022, 10:10pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925/1 "2022-06-18T22:10:49Z")

</div>

Hi everyone,

How can I get the unix timstamp out of this return from a system.tag.read command?

```auto
## Call
path = system.tag.read("[]MyTagPath")
print path

## Return
[1737.9868, Good, Sat Jun 18 16:56:10 CDT 2022 (1655589370000)]

## Preferred Return
1655589370000

```

system.tag.read().timestamp gives me the ordinary date time format and I’m struggling to convert it to unix in the script console.

Thank you,

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 18, 2022, 11:25pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925/2 "2022-06-18T23:25:33Z")

</div>

Try this in the Script Console.

```auto
path = system.tag.read("[]MyTagPath")
print type(path)
print path.getValue()
print path.getTimestamp()
print system.date.toMillis(path.getTimestamp())

```

You can read more about the data type here:  
[http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.0-beta/com/inductiveautomation/ignition/common/model/values/BasicQualifiedValue.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.0-beta/com/inductiveautomation/ignition/common/model/values/BasicQualifiedValue.html)

Someone else may have a more terse solution.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 18, 2022, 11:46pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925/3 "2022-06-18T23:46:31Z")

</div>

The timestamp you get from a QualifiedValue is a `java.util.Date`, on which you can call `getTime()`.

---

<div class="post-metadata">

**Author:** ![wbaker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wbaker/32/85315_2.png) [@wbaker](https://forum.inductiveautomation.com/u/wbaker)\
**Post date:** [June 19, 2022, 1:04pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-unix-timestamp-from-tag-read/60925/4 "2022-06-19T13:04:04Z")

</div>

Thank you both! For others, here is an example of the result.

```auto
## Call
reading_time = system.tag.read("[]MyTagPath")
print reading_time.timestamp.getTime() / 1000

## Result
1655643395

```
