//Variaveis var msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13 = {};
//Msgmsg1 = {payload: msg.payload.weather};msg2 = {payload: msg.payload.detail};msg3 = {payload: msg.payload.icon};msg4 = {payload: msg.payload.tempc};msg5 = {payload: msg.payload.humidity};msg6 = {payload: msg.payload.windspeed};msg7 = {payload: msg.payload.winddirection};msg8 = {payload: msg.payload.location};msg9 = {payload: msg.payload.sunrise};msg10 = {payload: msg.payload.sunset};msg11 = {payload: msg.payload.clouds};msg12 = {payload: msg.data.visibility};msg13 = {payload: msg.data.main.pressure};
// Update the status with current timestampvar now = new Date();var yyyy = now.getFullYear();var mm = now.getMonth() < 9 ? "0" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-basedvar dd = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();var hh = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();var mmm = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();var ss = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();node.status({fill:"blue",shape:"ring",text:"Last update: "+dd + "." + mm + "." + yyyy + " " + hh + ":" + mmm + ":" + ss});
return [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13];var teste = new Date(msg.payload.sunrise);
msg.payload = teste.toUTCString();
return msg;
anyone ? please
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/4aa38bc6-b39d-46d9-a14f-3beb4cab9534%40googlegroups.com.
var dtm = new Date(msg.payload.sunrise * 1000); // sunrise ms value is 1514308422000
var str = dtm.getLocaleTimeString(); // sunrise time is '12:13:42 PM' in my timezone (ymmv)//Variaveis var msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13 = {};
//Msgmsg1 = {payload: msg.payload.weather};msg2 = {payload: msg.payload.detail};msg3 = {payload: msg.payload.icon};msg4 = {payload: msg.payload.tempc};msg5 = {payload: msg.payload.humidity};msg6 = {payload: msg.payload.windspeed};msg7 = {payload: msg.payload.winddirection};msg8 = {payload: msg.payload.location};var teste ={payload: msg.payload.sunrise};msg9 = new Date(teste).toString();//msg9 = {payload: msg.payload.sunrise};msg10 = {payload: msg.payload.sunset};msg11 = {payload: msg.payload.clouds};msg12 = {payload: msg.data.visibility};msg13 = {payload: msg.data.main.pressure};
return [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13];var teste ={payload: msg.payload.sunrise};
which sets teste to an object with a property payload set to sunrise. Then you pass this to new Date() and not surprisingly it does not know what to do with it. I think what you want is
var teste = msg.payload.sunrise;
which sets teste to the sunrise value.
Colin
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/2c991d6a-5809-401b-b6fc-199fa5729c7b%40googlegroups.com.
anyone ? pleasethanks