Template node changing format of datetime stamp

I've got a flow that queries an Oracle DB and returns a datetime stamp, I'm then formatting it using a template node for ingestion into a Tulip Table node.

For some reason the template node is deciding that it should change the format of the stamp:

Input:

msg.completeDate: "2021-04-24T04:00:00.000Z"

Template node contents:

{
    "sfhqp_date_completed": "{{completeDate}}"
}

Output from the template node:

sfhqp_date_completed: "Sat Apr 24 2021 00:00:00 GMT-0400 (Eastern Daylight Time)"

Why is the template node changing the timestamp format?

I can't share too much for company reasons but if needed I can create a minimal reproducer in a separate flow but hopefully that's not needed.

The Oracle DB is returning a Date object. you will need to convert it with either JS in a function node
msg.sfhqp_date_completed = msg.completeDate.toISOString();
No template required then

Or ask Oracle to format it to an ISO timestamp Format Models

The reason that it comes out as it does in the template node is that the template node, seeing that it is not a string, calls toString() to convert it, which gives the string you see.

Thanks guys, I had to modify it slightly, but @E1cid suggestion worked.

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