Hi,
I do a API call to openweathermap using node-red-node-openweathermap - works 100%
The time returned is in Z time.
I then use a function none to create a insert statement to put the data into a MYSQL db.
Some how the time is changed to Coordinated Universal Time.
Now the MYSQL db doesn't like the time and inserts it as 0000-00-00 00:00:00.000000.
I have tried all sorts of different settings in the db but it stays as 0000-00-00 00:00:00.000000.
Any pointers will be appreciated.
[{"id":"71cd58d1.e9a748","type":"tab","label":"openweathermap","disabled":false,"info":""},{"id":"1ea5c8b4.fbc0c7","type":"openweathermap","z":"71cd58d1.e9a748","name":"","wtype":"current","lon":"","lat":"","city":"","country":"","language":"en","x":310,"y":160,"wires":[["31e31965.664ef6","dce1143.41e0ce8"]]},{"id":"9d0a892c.01b6d8","type":"inject","z":"71cd58d1.e9a748","name":"","props":[{"p":"location.lat","v":"-29.8064188","vt":"num"},{"p":"location.lon","v":"30.7717992","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":80,"y":160,"wires":[["1ea5c8b4.fbc0c7"]]},{"id":"31e31965.664ef6","type":"debug","z":"71cd58d1.e9a748","name":"openweathermap raw","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":500,"y":100,"wires":[]},{"id":"dce1143.41e0ce8","type":"function","z":"71cd58d1.e9a748","name":"","func":"var lat = msg.data.coord.lat;\nvar lon = msg.data.coord.lon;\n\nvar time = msg.time;\nvar city = msg.data.name;\nvar weather = msg.payload.weather; //rain,sun\nvar detail = msg.payload.detail; //light rain\nvar tempc = msg.payload.tempc; //current temp\nvar temp_maxc = msg.payload.temp_maxc; //predicted max temp\nvar temp_minc = msg.payload.temp_minc; //predicted min temp\nvar humidity = msg.payload.humidity; //predicted humidity\nvar pressure = msg.payload.pressure;\nvar windspeed = msg.payload.windspeed;\nvar winddirection = msg.payload.winddirection;\nvar sunrise = msg.payload.sunrise;\nvar sunset = msg.payload.sunset;\nvar clouds = msg.payload.clouds;\nvar visibility = msg.data.visibility;\n\nmsg.topic = \"INSERT INTO weathermap_t(lat, lon, time, city, weather, detail, tempc, temp_maxc, temp_minc, humidity, pressure, windspeed, winddirection, sunrise, sunset, clouds, visibility) VALUES (\" + lat + \",\" + lon + \",'\" + time + \"','\" + city + \"','\" + weather + \"','\" + detail + \"',\" + tempc + \",\" + temp_maxc + \",\" + temp_minc + \",\" + humidity + \",\" + pressure + \",\" + windspeed + \",\" + winddirection + \",\" + sunrise + \",\" + sunset + \",\" + clouds + \",\" + visibility + \");\";\n\ndelete msg.location;\ndelete msg.payload;\ndelete msg.time;\ndelete msg.title;\ndelete msg.description;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":160,"wires":[["6b7816af.3e8918","abaa7692.9c1d08"]]},{"id":"6b7816af.3e8918","type":"debug","z":"71cd58d1.e9a748","name":"openweathermap to db","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":520,"y":240,"wires":[]},{"id":"abaa7692.9c1d08","type":"link out","z":"71cd58d1.e9a748","name":"openweathermap","links":["678f136d.70fa4c","8f5157e8.9523a8"],"x":665,"y":160,"wires":[]},{"id":"678f136d.70fa4c","type":"link in","z":"71cd58d1.e9a748","name":"openweathermap","links":["abaa7692.9c1d08"],"x":745,"y":160,"wires":[[]]},{"id":"c618e04f.0d1ae","type":"inject","z":"71cd58d1.e9a748","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":520,"wires":[[]]}]