Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi, I need help.
I need to truncate seconds of each time (DATETIME) property of the property.
How can I do that?
I tried this code, but in Value stream I see time value equal to the passed parameter time:
var period 60000;
var t = time; /* input param DATETIME */
t /= period;
t *= period;
var params = {
propertyName: "SUMconsumption" /* STRING */,
value: value /* NUMBER */, /* input parameter */
timestamp: t /* DATETIME */
};
me.AddNumberValueStreamEntry(params);
Thanks in advance.
Hi,
Have you tried the following in the script? you can use the format string as required for your application.
dateFormat(time, "HH:mm")
Regards
Arunkumar D
Hi, Arunkumar.
I don't need a STRING value but I need a DATETIME value to store it into the ValueStream.
I've found such solution:
var period = 300000; //5 min in ms
var periodStart = time.getTime();
periodStart /= period;
periodStart = Math.floor(periodStart) * period;
periodStart = new Date(periodStart);