I'd like to add all values in a database from the last 24 hours. Each value has its TimeStamp in the database.
I tried to do that with a for-loop, which adds 86400 secs (24h) every time, picks all values from one day and after that it adds all values.
Heres my code:
> `$datestart = 153839251200; //start date
for($uts = $uts; $uts > $datestart; $datestart + 86400){
if (($uts <= ($datestart + 86400)) && ($uts > $datestart)){
$uts = $datestart + 86400;
$valueFinal = $valueFinal + $value;
}
}
if($Zeitalt != $uts){
$Zeitalt=date('l, F j y H:i:s',$uts);
$uts *= 1000; // convert from Unix timestamp to JavaScript time
$data[] = array((float)$uts,(float) $valueFinal);
}`
I hope this explanation is enough, I'm not English speaking as much, otherwise just ask for more information.
Regards DR.Alfred