# Date format in exec node

**URL:** <https://discourse.nodered.org/t/date-format-in-exec-node/1328>\
**Category:** General\
**Created:** [4 July 2018 18:04 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328 "2018-07-04T18:04:09Z")\
**Posts on this page:** 12\
**Page:** 1

<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:** [4 July 2018 18:04 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/1 "2018-07-04T18:04:09Z")

</div>

Good afternoon

I don't know why but after my latest update I have an issue with the exec node I'm using in order to get some data.

The most simple is running just the command "date", previously was working fine and if I test on a raspberry console returns me "mi� jul 4 19:58:07 CEST 2018" frankly speaking the part of "mi�" es new, never had this before-  
If I get the out of the exec node in node red with a debug I get:

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

Previously was running fine and on the other raspberry that I have for testing purposes it returns me directly the date/time as expected which I can directly pull to a text node.

How can I fix this? I guess there is some change done on the exec node at some point right?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 July 2018 18:58 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/2 "2018-07-04T18:58:27Z")

</div>

Which output of the exec node is that on? Can you export the exec node and paste it here.

---

<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:** [4 July 2018 19:00 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/3 "2018-07-04T19:00:42Z")

</div>

very strange...... as example one of the 3, the most simple

```auto
[{"id":"5d519dd4.aaf954","type":"inject","z":"38ad6844.92e088","name":"","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"x":273,"y":1489,"wires":[["b4a5ebb1.096c08"]]},{"id":"b4a5ebb1.096c08","type":"exec","z":"38ad6844.92e088","command":"date ","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":true,"name":"","x":553,"y":1489,"wires":[["b0503f8f.af7e2","641e44a.e8144bc"],[],[]]},{"id":"641e44a.e8144bc","type":"debug","z":"38ad6844.92e088","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":1500,"wires":[]},{"id":"b0503f8f.af7e2","type":"ui_text","z":"38ad6844.92e088","group":"6977e773.ba2438","order":1,"width":0,"height":0,"name":"","label":"Fecha","format":"{{msg.payload}}","layout":"row-spread","x":936,"y":1478,"wires":[]},{"id":"6977e773.ba2438","type":"ui_group","z":"","name":"system","tab":"5f054619.865f78","order":2,"disp":true,"width":"7","collapse":false},{"id":"5f054619.865f78","type":"ui_tab","z":"","name":"SYSTEM","icon":"fa-cog","order":11}]

```

Exactly the same flow on a previous raspi returns me as expected on debug ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/2d91ec69f9eb945f0f9829f72643e3efb2fb4c34.png)

Running the command in a console does not gives me the "mi�"

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 July 2018 20:03 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/4 "2018-07-04T20:03:03Z")

</div>

So it isn’t the flow it is something about the pi. Have you updated using the bash \<curl script? If so post the node red log on restart and on clicking the button.  
You posted a flow with a text node attached, but presumably you are seeing the problem in the debug node. Previously you posted some debug showing a buffer but it shouldn’t be a buffer it should be a string. I am wondering about the version of node.js which is why I would like to see the log.

---

<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:** [4 July 2018 20:08 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/5 "2018-07-04T20:08:26Z")

</div>

Yes the buffer shown is from the debug, but is displayed similar on the text node, I will cross check my node.js version and will post, the latest raspbian does not has pre-installed node-red however all the rest of my flows are working fine, and I have a lot of stuff…

I installed from 0 using curl script yes.

---

<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:** [4 July 2018 20:13 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/6 "2018-07-04T20:13:48Z")

</div>

pi@raspberrypi:~ $ node -v  
v8.11.3

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 July 2018 20:16 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/7 "2018-07-04T20:16:21Z")

</div>

That’s ok. Can you post the log then.

---

<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:** [4 July 2018 20:18 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/8 "2018-07-04T20:18:30Z")

</div>

I don't have any error, the point is that the exec node returns me this buffer instead of the expected string with the date as I see if I run the command on a console, so on dashboard shows me the buffer

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/630ae48c7281f662c05ee1f5ebe94e1b9bb397fd.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/69067958ea8a1093ea84b1dfc578d85f2b3212af.png)

I don't understand why...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 July 2018 20:28 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/9 "2018-07-04T20:28:28Z")

</div>

Oh, sorry, I missed the fact that it shows the wrong thing in the console. Nothing to do with node-red then, but an issue with the pi. You haven’t got a funny language setup accidentally have you? Something like that.

Run `sudo raspi-config` and check the localisation options.

---

<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:** [4 July 2018 21:04 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/10 "2018-07-04T21:04:46Z")

</div>

Before posting I had already ran raspy-config and checked my locales and all apparently was ok, also rebooted with no success, maybe is linked to that odd "mi�”, I will try to google it a bit more.

I don’t know what u mean about funny lang, I think not in this case.

Thanks anyway colin

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 July 2018 21:18 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/11 "2018-07-04T21:18:16Z")

</div>

The exec node does look to see if the response is a UTF8 string and if so returns a string - and if not sends it as-is which will be a buffer. So maybe Wed(nesday) in your locale has an accent that makes it not UTF8 ?  
You can always use a following function node to .toString() it forcibly if you wish.

---

<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:** [4 July 2018 21:43 UTC](https://discourse.nodered.org/t/date-format-in-exec-node/1328/12 "2018-07-04T21:43:11Z")

</div>

bravo dceejay!!! You are the one, curiously I had already checked but when you told abouit the accent… make me think about it, and yes, doing sudo raspi-config I configured the locales for sudo that is not the user that runs node-red…

I had to enable VNC and graphical again and change it from desktop to be able to change the locale of pi and now is solved.

Thanks a lot guys
