Creating New equation

Hello! I would like to create a new equation using a specific variable.
This variable shows the total energy every specific time (refresh every 5 sec). I aim to create an equation where will be done a subtraction between this variable at 00:00 of this day (subtracter) and the instant Value of energy (subtrahend) as i take it from Mango.
Let's assume E is the total energy variable, i would like to create an equation like: E(t)E(00:00start of the day). Is any way to implement this?
Thanks in advance,
Nikos. 
Hi Nikos,
Yes, you could use a meta point like,
var dayStartTime = new Date(); dayStartTime.setHours(0); dayStartTime.setMinutes(0); dayStartTime.setSeconds(0); dayStartTime.setMilliseconds(1); //Get the value before the first millisecond of the day // (00:00:00.000, or the last value from yesterday if it didn't change) var subtracter = variableContextPoint.pointValueBefore(dayStartTime.getTime()) var subtrahend = energyContextPoint.value; if(subtracter == null) return subtrahend; return subtracter.doubleValue  subtrahend;