Help with Date/Time Formatter node

Clearly, UTC is UTC (AKA GMT, AKA Zulu time) so it can only ever be a time at the Greenwich meridian.

The moment node uses the Moment library, the same as does $moment in JSONata in a change node, just a bit more friendly.

To output a local time, you must use the formatting option to something appropriate.

Please note that the moment node has some convenient example flows built-in to help you:

Use Node-RED's Import function and go to Examples and expand the moment node to see all of these, try importing the last of the examples which gives you this:

You need an output format something like this to get a localised time output:

image

Converted outputs are a STRING, not a Date object.


For the sake of completeness, I should also point out that modern JavaScript has lots of international date/time conversion tools built in. Check out the INTL object for details. There isn't a specific node that exposes these but they can be used in a function node.

The moment node wraps the moment library in a more friendly node than JSONata in a change node. They both use the same library. :wink: