# How do I get Unix Epoch Time?

**URL:** <https://community.cdata.com/t/how-do-i-get-unix-epoch-time/626>\
**Category:** CData Arc\
**Tags:** question, time-format\
**Created:** [February 13, 2024, 11:02am UTC](https://community.cdata.com/t/how-do-i-get-unix-epoch-time/626 "2024-02-13T11:02:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [February 13, 2024, 11:02am UTC](https://community.cdata.com/t/how-do-i-get-unix-epoch-time/626/1 "2024-02-13T11:02:50Z")

</div>

In PHP I can use ‘U’ format. How do I do this in Arc Script?

So far I’ve got

\<arc:set attr=“expiry”\>[utcnow() | dateadd(‘day’, 7) | todate(‘U’)]\</arc:set\>

But ‘U’&nbsp;is not recognised, and I get

**Error:**

Formatter todate failed in the evaluation of [utcnow()|dateadd(‘day’, 7)|todate(‘U’)]. The error was:Input string was not in a correct format.Value: 2024-02-20T11:07:09+00:00Parameters: U

---

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [February 13, 2024, 11:26am UTC](https://community.cdata.com/t/how-do-i-get-unix-epoch-time/626/2 "2024-02-13T11:26:31Z")

</div>

OKay, I figured it out

\<arc:set attr=“expiry”\>[utcnow(‘U’)|dateadd(‘day’, 7)|datediff(‘second’, ‘1970-01-01’)]\</arc:set\>

---

<div class="post-metadata">

**Author:** ![James\_B](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/james_b/32/1688_2.png) [@James\_B](https://community.cdata.com/u/James_B)\
**Post date:** [February 13, 2024, 7:13pm UTC](https://community.cdata.com/t/how-do-i-get-unix-epoch-time/626/3 "2024-02-13T19:13:02Z")

</div>

There is also a “unix” formatter to the now expression:

```auto
[now(unix)]

```

This will return the time as epoch
