# 2 Formatting node dont give the same result

**URL:** <https://discourse.nodered.org/t/2-formatting-node-dont-give-the-same-result/49609>\
**Category:** General\
**Created:** [11 August 2021 09:55 UTC](https://discourse.nodered.org/t/2-formatting-node-dont-give-the-same-result/49609 "2021-08-11T09:55:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)\
**Post date:** [11 August 2021 09:55 UTC](https://discourse.nodered.org/t/2-formatting-node-dont-give-the-same-result/49609/1 "2021-08-11T09:55:26Z")

</div>

Can someone tell me why I cant get the Hour out of this time formatting node.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b85a91400d4dc2a94fbdb1ee6806f8f4a069d5c4.png)  
It is like there is a set var. that is "2"  
I have the same settings as the one below.

```auto
[{"id":"f94f3a76a143067f","type":"debug","z":"9ef76333.a9baf","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":1320,"wires":[]},{"id":"d80e4ff98db0c5b3","type":"dsm","z":"9ef76333.a9baf","name":"Time tæller","sm_config":"{\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"on\": \"started\"\n },\n \"started\": {\n \"inc\": \"counting\",\n \"off\": \"stopped\"\n },\n \"counting\": {\n \"inc\": \"counting\",\n \"off\": \"stopped\"\n }\n },\n \"data\": {\n \"prev_time\": null,\n \"time\": 0,\n \"seconds\": 0,\n \"interval\": 1,\n \"interval_output\": true,\n \"hms_format\": true\n },\n \"methods\": {\n \"init\": [\n \"sm.calc_time = function() {\",\n \" var now = Date.now();\",\n \" sm.data.time += now - sm.data.prev_time;\",\n \" sm.data.prev_time = now;\",\n \" sm.data.seconds = Math.round(sm.data.time / 1000);\",\n \"};\",\n \"sm.sec2hhmmss = function(sec) {\",\n \"var t = {};\",\n \"t.h = pad(Math.floor(sec / 3600));\",\n \"sec %= 3600;\",\n \"t.m = pad(Math.floor(sec / 60));\",\n \"t.s = pad(sec % 60);\",\n \"return t.h+':'+t.m+':'+t.s;\",\n \"};\"\n],\n \"on\": [\n \"if (sm.currentState === 'started') {\",\n \" sm.data.prev_time = Date.now();\",\n \" resume('inc', msg);\",\n \"}\",\n \"output = false;\"\n],\n \"inc\": [\n \"timeout.interval = setTimeout(function() {\",\n \" sm.calc_time();\",\n \" msg.data = sm.data;\",\n \" if (sm.data.interval_output) {\",\n \" msg.payload = sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds;\",\n \" node.send(msg);\",\n \" }\",\n \" resume('inc', msg);\",\n \"}, sm.data.interval*1000);\",\n \"output = false;\"\n],\n \"off\": [\n \"clearTimeout(timeout.interval);\",\n \"sm.calc_time();\",\n \"msg.payload = sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds;\"\n],\n \"reset\": [\n \"sm.data.time = 0;\",\n \"sm.data.seconds = 0;\"\n],\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'counting' ? 'green' : 'grey';\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"'time ' + (sm.data.hms_format ? sm.sec2hhmmss(sm.data.seconds): sm.data.seconds);\"\n }\n }\n }\n}\n","x":1140,"y":1260,"wires":[["f94f3a76a143067f","88dea60ccd09075f","794d2cf87c4ccb6f"]]},{"id":"88dea60ccd09075f","type":"moment","z":"9ef76333.a9baf","name":"Format time","topic":"","input":"payload","inputType":"msg","inTz":"Africa/Abidjan","adjAmount":"0","adjType":"seconds","adjDir":"add","format":"hh:mm:ss","locale":"en-US","output":"time","outputType":"msg","outTz":"Europe/Copenhagen","x":1350,"y":1320,"wires":[["fbf03a44ec3e1a23"]]},{"id":"794d2cf87c4ccb6f","type":"moment","z":"9ef76333.a9baf","name":"test time","topic":"","input":"payload","inputType":"msg","inTz":"Africa/Abidjan","adjAmount":"0","adjType":"seconds","adjDir":"add","format":"hh:mm:ss","locale":"en-US","output":"time","outputType":"msg","outTz":"Europe/Copenhagen","x":1340,"y":1260,"wires":[["b3063e4d8f941d2d","22b87c4e1f149913"]]}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 August 2021 17:39 UTC](https://discourse.nodered.org/t/2-formatting-node-dont-give-the-same-result/49609/2 "2021-08-11T17:39:49Z")

</div>

show us what is coming out ot the 'Time Taeller' node, you have the debug node shut off.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 October 2021 17:40 UTC](https://discourse.nodered.org/t/2-formatting-node-dont-give-the-same-result/49609/3 "2021-10-10T17:40:40Z")

</div>

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