ISO8601 time in DD-MM-YYYY

361 views
Skip to first unread message

Lestat De la Morte

unread,
Mar 27, 2017, 3:12:43 PM3/27/17
to Node-RED
    Hi guys,

      
i need a little help on how to show time in DD-MM-YYYY in a table in the dashboard.  I'm having this flow where an array comes from a Mysql query:

 And in the dashboard it shows like this:


      















So i'd like to have my dates whitout the HH-MM-SSZ. I tried all sorts of things to no avail, 

Thanks again.                    

Julian Knight

unread,
Mar 27, 2017, 3:38:53 PM3/27/17
to Node-RED
Just use my moment node, you can format your date anyway you like then.


On Monday, 27 March 2017 20:12:43 UTC+1, Lestat De la Morte wrote:
    Hi guys,

      
i need a little help on how to show time in DD-MM-YYYY in a table in the dashboard.  I'm having this flow where an array comes from a Mysql query:
n.                    

Lestat De la Morte

unread,
Mar 27, 2017, 3:51:55 PM3/27/17
to Node-RED
Thanks Julian i tried it earlyer but it gives me: 

The input property was NOT a recognisable date. Output will be a blank string

and i loose everything in my table... 

But it works great with just an inject node though. iconfigured it as follow: 


I'm missing something obviously...

Julian Knight

unread,
Mar 27, 2017, 5:02:10 PM3/27/17
to Node-RED
Ah, maybe I should have looked more closely. You are sending a table. It's not set up for that.

Can you share the output from the db query node? Then we can work out the best way. My node only uses moment.js under the skin.

Max Hadley

unread,
Mar 27, 2017, 5:05:09 PM3/27/17
to Node-RED
ISO format has YYYY-MM-DD and not DD-MM-YYYY - is this your problem?


On Monday, 27 March 2017 20:51:55 UTC+1, Lestat De la Morte wrote:

Julian Knight

unread,
Mar 27, 2017, 6:10:59 PM3/27/17
to Node-RED
Actually, I must be tired. The obvious answer is for you to adjust your SQL query to give you the dates and times in the format you want in the first place.

Lestat De la Morte

unread,
Mar 27, 2017, 6:50:26 PM3/27/17
to Node-RED
Yahoo! Thanks for the tip Jordan, i nailed it directly within the query with the MYSQL DATE_FORMAT function.

msg.topic = "SELECT DATE_FORMAT(`time_deb`, '%d-%m-%Y') AS jour, pompe, SEC_TO_TIME(SUM(duration))AS Hrs, sum(departs)AS departs from `vue_5` where `time_deb` is not NULL group by  DATE_FORMAT(`time_deb`, '%d-%m-%Y'), pompe order by  DATE_FORMAT(`time_deb`, '%d-%m-%Y'), pompe ASC LIMIT 65 " ;
return msg;

and here it is, nice and clean with borders and some css to put the values in the center of the cell.




Le lundi 27 mars 2017 15:12:43 UTC-4, Lestat De la Morte a écrit :
Message has been deleted

Lestat De la Morte

unread,
Mar 27, 2017, 7:09:32 PM3/27/17
to Node-RED
No Max, that was just a typo, in french we use that order ex: 27 march 2017.
Reply all
Reply to author
Forward
0 new messages