Format timestamp in $now() function inside JSONata Expression Editor

Hello guys.

I'm starting to learn the things involved in Node Red, including JavaScript and JSON.
Today, using the JSONata Expression Editor in Change Node to define a message, I tried to put the optional parameters for the $now () function, according to JSONata documentation, in order to format the timestamp.

$now ('[H01]:[m01]:[s01]')

But I get the following error:
Invalid JSONata expression: The argument 1 of the "now" function does not match the signature of the function.

Does Node Red accept the optional parameters for functions listed in the JSONata documentation?

What version of Node-RED are you using?

Node-RED 0.19.5 has JSONata 1.5.4
Node-RED 0.20.0-beta.4+ has JSONata 1.6.4

@jhmluna, search this discussion for "JSONata timestamp", and you will find this thread. My comments and replies from @knolleary and @dceejay will answer your question.

Just to share things, this is my (now) best solution.

msg.time = new Date().toLocaleString();
return msg;

in a function node.

1 Like

Hi there.

Is 0.19.5.

@drmibell After read the tread, I finally understand.
Thank you all.