# Anyone one convert timestamp (epoc) to formatted time string in a single change node?

**URL:** <https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482>\
**Category:** General\
**Created:** [7 November 2020 03:36 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482 "2020-11-07T03:36:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [7 November 2020 03:36 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482/1 "2020-11-07T03:36:58Z")

</div>

Anyone one convert timestamp (epoc) to formatted time string in a single change node? Say YYYY-MM-DD HH:MM:SS representation. No need for local time, just a UTC epoch to formatted string.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [7 November 2020 07:11 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482/2 "2020-11-07T07:11:19Z")

</div>

Change node with Jsonata, which has the momentjs library built in.

 ![Screenshot 2020-11-07 at 08.10.40](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7cccc23aed4d96ef7478f35750ba283b8e1df58d.jpeg)

oops the `HH:MM:SS` should be `HH:mm:ss` 😉 but i hope you get the gist. [Documentation](https://momentjs.com/docs/#/parsing/string-format/).

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [7 November 2020 09:20 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482/3 "2020-11-07T09:20:04Z")

</div>

Or  
`$fromMillis(payload, "[Y]-[M01]-[D01] [h01]:[m01]:[s01]")`

> **[XPath and XQuery Functions and Operators 3.1](https://www.w3.org/TR/xpath-functions-31/#date-picture-string)**

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 November 2020 00:11 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482/4 "2020-11-08T00:11:47Z")

</div>

I have GOT to spend some REAL time with JSON functions/data. I have barely used XPATH, so have some learning to do there as well. Thanks guys, this is great, thanks for the nudge in the right direction!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 January 2021 00:11 UTC](https://discourse.nodered.org/t/anyone-one-convert-timestamp-epoc-to-formatted-time-string-in-a-single-change-node/35482/5 "2021-01-07T00:11:51Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
