Hi,
I want to compare the data of two sensors that I have taken from mysql server in separate graphs. I can extract the data, but I cannot change the time data of the data I have taken with the time data of my own country. Mysql gives the timestamp. In mysql, the time data is set according to my country, but when I graph it, it is different. Thanks in advance.
[{"id":"0424b2b4c7dcef82","type":"tab","label":"Flow 17","disabled":false,"info":"","env":[]},{"id":"4e4b8cabc3b101fd","type":"mysql","z":"0424b2b4c7dcef82","mydb":"496de392.ca2cbc","name":"","x":1030,"y":480,"wires":[["7ceed94ce019b30a"]]},{"id":"a6a85e635c1b8c81","type":"ui_chart","z":"0424b2b4c7dcef82","name":"","group":"2f70fd7d67ed6a37","order":11,"width":30,"height":5,"label":"","chartType":"line","legend":"true","xformat":"Y-M-D / HH:mm","interpolate":"linear","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f96ea","#0bf933","#f97d10","#2ca02c","#37f20d","#fb0909","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1370,"y":480,"wires":[["17c229bfcd53e037"]]},{"id":"7ceed94ce019b30a","type":"function","z":"0424b2b4c7dcef82","name":"","func":"var sec_sens1 = flow.get( \"secim1\" ) || false ;\nvar sec_sens = flow.get( \"secim\" ) || false ; \n\nvar data1 = [];\nvar data = [];\nvar Zaman = [];\nvar Zaman1 = [];\nmsg.payload.forEach(function(value) {\n \n data.push(value[ sec_sens1 ] ); // temp or hum choice \n Zaman1.push(value['Zaman'] ); // time data /* Exp: Zaman = Time */\n \n});\n\n\nmsg.payload = [{\n \n series: [ \"\"+ sec_sens + \" \" + sec_sens1 +\" verisi\"],\n data: [ data ],\n labels: Zaman1\n\n}];\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":480,"wires":[["a6a85e635c1b8c81"]]},{"id":"ddc84350205d327c","type":"ui_button","z":"0424b2b4c7dcef82","name":"","group":"2f70fd7d67ed6a37","order":5,"width":3,"height":2,"passthru":false,"label":"Get","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"date","topic":"query","topicType":"str","x":490,"y":740,"wires":[["ad6063b002dab439","40f2c29276b35e88"]]},{"id":"ad6063b002dab439","type":"function","z":"0424b2b4c7dcef82","name":"sensor_1 get_data","func":"\n\nif( msg.topic == \"download\" || msg.topic == \"query\" ){\n \n \n\n var sec_sens = flow.get( \"secim\" )|| false ; // sensor choice\n \n var start_Date = flow.get( \"startDate\" ) || false ;\n var start_Time = flow.get( \"bas_saat\" ) || false ;\n \n var end_Date = flow.get( \"endDate\" ) || false ;\n var end_Time = flow.get(\"bitis_saat\") || false ;\n\n\n // check if date range is correct\n if ( start_Date && end_Date && ( new Date(end_Date) >= new Date(start_Date) ) ) \n {\n msg.topic = \"select * from \" + sec_sens + \" where Zaman between '\" + start_Date + \" \" + start_Time + \"' and '\" + end_Date +\" \" + end_Time + \"'\";\n return msg; /* Exp: Zaman = Time */\n } else {\n node.warn(\"end date is before start date. or context not set\");\n }\n\n \n\n}\n\n\n\n\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":480,"wires":[["4e4b8cabc3b101fd"]]},{"id":"6740b9e2d375bdaf","type":"ui_date_picker","z":"0424b2b4c7dcef82","name":"","label":"Start Date","group":"2f70fd7d67ed6a37","order":1,"width":7,"height":1,"passthru":false,"topic":"payload","topicType":"msg","className":"","x":160,"y":440,"wires":[["c9acf1dc3f2925f5"]]},{"id":"c9acf1dc3f2925f5","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"startDate","pt":"flow","to":"$moment($$.payload).format(\"YYYY-MM-DD\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":440,"wires":[["ad6063b002dab439","40f2c29276b35e88"]]},{"id":"f32796b5301820ab","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"endDate","pt":"flow","to":"$moment($$.payload).format(\"YYYY-MM-DD\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":540,"wires":[["ad6063b002dab439","40f2c29276b35e88"]]},{"id":"ef204d753f542bca","type":"ui_date_picker","z":"0424b2b4c7dcef82","name":"","label":"End Date","group":"2f70fd7d67ed6a37","order":6,"width":7,"height":1,"passthru":false,"topic":"payload","topicType":"msg","className":"","x":160,"y":540,"wires":[["f32796b5301820ab"]]},{"id":"7f8abebbde21c18f","type":"ui_dropdown","z":"0424b2b4c7dcef82","name":"","label":"Sensor choice","tooltip":"","place":"Select option","group":"2f70fd7d67ed6a37","order":3,"width":7,"height":1,"passthru":true,"multiple":false,"options":[{"label":"1.Sensor","value":"sensor_1","type":"str"},{"label":"2.Sensor ","value":"sensor_2","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":200,"y":340,"wires":[["611fc42c08b5ae88"]]},{"id":"611fc42c08b5ae88","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"secim","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":340,"wires":[["ad6063b002dab439"]]},{"id":"771382fe2f6433f8","type":"ui_dropdown","z":"0424b2b4c7dcef82","name":"","label":"Temp / hum choice","tooltip":"","place":"Select option","group":"2f70fd7d67ed6a37","order":8,"width":7,"height":1,"passthru":true,"multiple":false,"options":[{"label":"Sicaklik","value":"Sicaklik","type":"str"},{"label":"Nem","value":"Nem","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":210,"y":280,"wires":[["cc5ba836795edaeb"]]},{"id":"cc5ba836795edaeb","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"secim1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":280,"wires":[["ad6063b002dab439"]]},{"id":"c4083ba776adb76e","type":"ui_dropdown","z":"0424b2b4c7dcef82","name":"","label":"Temp / Hum choice","tooltip":"","place":"Select option","group":"2f70fd7d67ed6a37","order":9,"width":7,"height":1,"passthru":true,"multiple":false,"options":[{"label":"Sicaklik","value":"Sicaklik","type":"str"},{"label":"Nem","value":"Nem","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":210,"y":140,"wires":[["b524e928807377d3"]]},{"id":"ac9db0c594ffba20","type":"ui_dropdown","z":"0424b2b4c7dcef82","name":"","label":"Sensor choice","tooltip":"","place":"Select option","group":"2f70fd7d67ed6a37","order":4,"width":7,"height":1,"passthru":true,"multiple":false,"options":[{"label":"1.Sensor","value":"sensor_1","type":"str"},{"label":"2.Sensor","value":"sensor_2","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":200,"y":200,"wires":[["e8b2d7146d1eff2c"]]},{"id":"b524e928807377d3","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"k_secim2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":140,"wires":[["ad6063b002dab439"]]},{"id":"e8b2d7146d1eff2c","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"k_secim3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":200,"wires":[["40f2c29276b35e88"]]},{"id":"17c229bfcd53e037","type":"debug","z":"0424b2b4c7dcef82","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1570,"y":480,"wires":[]},{"id":"7d8cf23c258dee52","type":"function","z":"0424b2b4c7dcef82","name":"","func":"var sec_sens2 = flow.get( \"k_secim2\" ) || false ;\nvar sec_sens3 = flow.get( \"k_secim3\" ) || false;\n\n\nvar data1 = [];\nvar data = [];\nvar Zaman = [];\nvar Zaman1 = [];\nmsg.payload.forEach(function(value) {\n\n data1.push(value[sec_sens2] ); // temp or hum choice\n Zaman1.push(value[ 'Zaman' ] ); // time data /* Exp: Zaman = Time */\n \n \n});\n\n\nmsg.payload = [{\n \n series: [ \"\"+ sec_sens3 + \" \" + sec_sens2 +\" verisi\" ],\n data: [ data1 ],\n labels: Zaman1\n\n}];\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":720,"wires":[["8c7d7df15df922b1"]]},{"id":"40f2c29276b35e88","type":"function","z":"0424b2b4c7dcef82","name":"sensor_2 get_data","func":"\n if(msg.topic == \"query\") {\n \n var start_Date = flow.get( \"startDate\" ) || false; \n var end_Date = flow.get( \"endDate\" ) || false;\n var start_Time = flow.get( \"bas_saat\" ) || false;\n var end_Time = flow.get( \"bitis_saat\") || false; \n var sec_sens3 = flow.get( \"k_secim3\" ) || false; // sensor choice\n\n\n\n // check if date range is correct\n if ( start_Date && end_Date && ( new Date(end_Date) >= new Date(start_Date) ) ) \n {\n msg.topic = \"select * from \" + sec_sens3 + \" where Zaman between '\" + start_Date + \" \" + start_Time + \"' and '\" + end_Date +\" \" + end_Time + \"'\";\n return msg; /* Exp: Zaman = Time */\n } else {\n node.warn(\"end date is before start date. or context not set\"); \n \n \n \n }\n\n }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":720,"wires":[["c3bd4187532e401b"]]},{"id":"c3bd4187532e401b","type":"mysql","z":"0424b2b4c7dcef82","mydb":"496de392.ca2cbc","name":"","x":1030,"y":720,"wires":[["7d8cf23c258dee52"]]},{"id":"8c7d7df15df922b1","type":"ui_chart","z":"0424b2b4c7dcef82","name":"","group":"2f70fd7d67ed6a37","order":12,"width":30,"height":5,"label":"","chartType":"line","legend":"true","xformat":"Y-M-D / HH:mm","interpolate":"linear","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fbff05","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1370,"y":720,"wires":[["60a377e59258e76d"]]},{"id":"2dd9885d8531bbe2","type":"ui_text_input","z":"0424b2b4c7dcef82","name":"","label":"Start Hours","tooltip":"","group":"2f70fd7d67ed6a37","order":2,"width":6,"height":1,"passthru":true,"mode":"time","delay":"0","topic":"bas_saat","sendOnBlur":true,"className":"","topicType":"msg","x":170,"y":480,"wires":[["2acf61dba9fe6bf0"]]},{"id":"4b926fd73aadd78a","type":"ui_text_input","z":"0424b2b4c7dcef82","name":"","label":"End Hours","tooltip":"","group":"2f70fd7d67ed6a37","order":7,"width":6,"height":1,"passthru":true,"mode":"time","delay":"0","topic":"bitis_saat","sendOnBlur":true,"className":"","topicType":"msg","x":190,"y":600,"wires":[["4ead07af8f415053"]]},{"id":"2acf61dba9fe6bf0","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"bas_saat","pt":"flow","to":"$moment($$.payload).tz(\"UTC\").format(\"HH:mm:ss\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":480,"wires":[["ad6063b002dab439","40f2c29276b35e88"]]},{"id":"4ead07af8f415053","type":"change","z":"0424b2b4c7dcef82","name":"","rules":[{"t":"set","p":"bitis_saat","pt":"flow","to":"$moment($$.payload).tz(\"UTC\").format(\"HH:mm:ss\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":600,"wires":[["ad6063b002dab439","40f2c29276b35e88"]]},{"id":"60a377e59258e76d","type":"debug","z":"0424b2b4c7dcef82","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1550,"y":720,"wires":[]},{"id":"496de392.ca2cbc","type":"MySQLdatabase","name":"","host":"127.0.0.1","port":"3306","db":"dnm","tz":"","charset":"UTF8"},{"id":"2f70fd7d67ed6a37","type":"ui_group","name":"Database veri çekme","tab":"22aa4264a26a4cce","order":1,"disp":true,"width":30,"collapse":false,"className":""},{"id":"22aa4264a26a4cce","type":"ui_tab","name":"Sensor 3","icon":"dashboard","order":3,"disabled":false,"hidden":false}]