# Using "moment" node. Not quite there

**URL:** <https://discourse.nodered.org/t/using-moment-node-not-quite-there/1962>\
**Category:** General\
**Created:** [1 August 2018 06:58 UTC](https://discourse.nodered.org/t/using-moment-node-not-quite-there/1962 "2018-08-01T06:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [1 August 2018 06:58 UTC](https://discourse.nodered.org/t/using-moment-node-not-quite-there/1962/1 "2018-08-01T06:58:11Z")

</div>

The MOMENT node is supposed to help with date/time formatting.

I am wanting to Human readable timestamp a message and write it to a file with other data.

This is the flow, and it nearly gets the right time:  
Local date/time is (now) 2018 08 01 16:56  
The output of the flow is the right date but the time is 06:56 (Not with the GMT offset.)  
But the node has the settings set to the correct local time zone.

```auto
[{"id":"5ab558bd.ac87d","type":"inject","z":"afeeae02.67742","name":"","topic":"","payload":"Blah","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":920,"wires":[["b6f9f2fe.7849c8"]]},{"id":"b6f9f2fe.7849c8","type":"function","z":"afeeae02.67742","name":"","func":"msg.payload = {\n date:Date.now()\n}\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":920,"wires":[["e637e76.55b0518","754974cf.7b9d9c"]]},{"id":"e637e76.55b0518","type":"moment","z":"afeeae02.67742","name":"","topic":"","input":"date","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"","locale":"en_AU","output":"payload","outputType":"msg","outTz":"Australia/Sydney","x":590,"y":920,"wires":[["a42a2937.c49d1"]]},{"id":"a42a2937.c49d1","type":"debug","z":"afeeae02.67742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":920,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [1 August 2018 07:42 UTC](https://discourse.nodered.org/t/using-moment-node-not-quite-there/1962/2 "2018-08-01T07:42:11Z")

</div>

I had the same with setup at locale while on a normal console if I check "date" is ok.... just correct it with the adjustment in my case:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e4fd68a8180d378d173ae06d7cc6c2099c107dc9.png)

Just a note in case is usefull for you....

you can reformat the output at your wish as example:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2ec57086c833afa8489d50affc3ccfe9903bdf32.png)

Will return you as output example: mar. 02 ene. 02:34:47  
More option check for linux command date on google or "man date" on a console.

Regards

---

<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:** [1 August 2018 07:51 UTC](https://discourse.nodered.org/t/using-moment-node-not-quite-there/1962/3 "2018-08-01T07:51:09Z")

</div>

Weirdly once I set the ddd DD MMM (etc) the time became correct.

All happy now.

Appreciated.
