Hi,
I'm doing a node red program to report stats in dashboard on photovoltaic installation.
I'm using a RPI and I'm working with SQLite DB.
Every last day of month, I want to write in a SQLite table the enery consumption of that month.
Actually, in a function with this code, I'm getting this result:
14/7/2019, 15:39:22node: ab2700e4.732c7msg.payload : Date
"Wed Jul 31 2019 00:00:00 GMT+0200 (GMT+02:00)"
Think it can work with a comparison on the actual date and time with this last day of month Date to write to DB.
The only thing I would like to change in that result, is this, I wolud prefer this result:
"Wed Jul 31 2019 23:59:59 GMT+0200 (GMT+02:00)"
This is the code I used in function:
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
var outp={ payload: (lastDayOfMonth)};
return [outp];