Rama Tito
asked on
Time different while select data - timestamp
Hi,
In node red, while i insert the - timestamp datatype its work perfectly. while try to select data with the time stamp, its display different time.
Data insert in mariadb ----> 2018-09-19 23:47:26
While select data
While try pull data out of mariadb the data timestamp show --> 2018-09-19 00:20:00
In node red, while i insert the - timestamp datatype its work perfectly. while try to select data with the time stamp, its display different time.
Data insert in mariadb ----> 2018-09-19 23:47:26
While select data
if (Device > 0)
msg.topic ="Select DeviceId, Line, outPIN, count,Time FROM mytab LIMIT 1";
return msg;
While try pull data out of mariadb the data timestamp show --> 2018-09-19 00:20:00
ASKER
var dt = new Date();
var year = dt.getFullYear();
var month = dt.getMonth()+1;
month = ("0" + month).slice(-2);
var date1 = dt.getDate();
date1 = ("0" + date1).slice(-2)
var hour = dt.getHours();
hour = ("0" + hour).slice(-2);
var minute = dt.getMinutes();
minute=("0" +minute).slice(-2);
var sec = dt.getSeconds();
sec=("0" + sec).slice(-2);
var dtout = year+"-"+month+"-"+date1+" "+hour+":"+minute+":"+sec;
if(msg.payload == 1)
{
//msg.topic ="Production/SSL";
msg.payload = {
Device_ID : 2,
Line_ID : 1,
GPIO : 7,
Count : 1,
dtout : dtout
}
}
msg.topic = "INSERT INTO mytab (DeviceId,Line,outPIN,count,Time) VALUES (?,?,?,?,?)";
msg.payload = [msg.payload.Device_ID, msg.payload.Line_ID , msg.payload.GPIO, msg.payload.Count, msg.payload.dtout];
return msg;
What do you get if you put this on line 20
console.log(dtout);
ASKER
2018-09-20 16:30:24 which is same has my local machine
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
We would need to see what was sent as well as what is in the DB.