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

**URL:** https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440
**Category:** General
**Created:** [31 January 2019 16:55 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440 "2019-01-31T16:55:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jhmluna](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhmluna/32/5395_2.png) [@jhmluna](https://discourse.nodered.org/u/jhmluna)
#### Post date: [31 January 2019 16:55 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440/1 "2019-01-31T16:55:08Z")

</div>

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](http://docs.jsonata.org/date-time-functions), 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?

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [31 January 2019 16:59 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440/2 "2019-01-31T16:59:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)
#### Post date: [31 January 2019 17:06 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440/3 "2019-01-31T17:06:13Z")

</div>

@jhmluna, search this discussion for "JSONata timestamp", and you will find this [thread](https://discourse.nodered.org/t/timestamps-sorry/7364). My comments and replies from @knolleary and @dceejay will answer your question.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [31 January 2019 19:50 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440/4 "2019-01-31T19:50:03Z")

</div>

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

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

```

in a function node.

---

<div class="post-metadata">

### Author: ![jhmluna](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhmluna/32/5395_2.png) [@jhmluna](https://discourse.nodered.org/u/jhmluna)
#### Post date: [1 February 2019 01:34 UTC](https://discourse.nodered.org/t/format-timestamp-in-now-function-inside-jsonata-expression-editor/7440/5 "2019-02-01T01:34:13Z")

</div>

Hi there.

Is 0.19.5.

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