Changing timestamp formats

Hey everyone,

Can someone help me to change two timestamps with the following Format (Start: "2013-02-04T22:44:30.652Z", End: 2013-02-07T22:44:30.652Z ) into (Start: "04.02.2013", End: "07.02.2013")? Is it possible by using a function node for that? I know, that there is the moment-node for this operation, but i don't want to split my two date into two payloads and join them together again to form one payload.

King regards
Marcus

Presumming your example is in msg.payload.
In a change node
set msg. payload.Start
to, select JSONata J:
$moment($$.payload.Start).format("DD.MM.YYYY")
Repeat for end.
Make sure the payload is an object and not a JSON string, you can use a json node to switch between either, or some nodes allow you to select a parse object as the output format.

Hey E1cid,

Thanks a lot for your fast reply! I tried it and it worked perfectly.

1 Like

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