Look, i got it!


test.­txt
06.12.2019 16:26:08
0 MB (e303407948b4dff9e08c7326683a8fa3)

http://files.q3t.de/a/get/dd18bf3a8e0a2a3e53e2661c7fb53534

function calc_dur($data) { if($data['date']) return $data['duration']; else return $data['enddate']-$data['startdate']; } $table = '' for($day=STARTTAG; $day<=$ENDTAG; $day++) { // 'k, um den richtigen Tag als Datum, timestamp, whatever zu haben muss man etwas basteln... $q=pg_query("SELECT * FROM activities WHERE ( startdate<=$day AND enddate>=$day+23h59m ) OR date=$day;"); $total_dur = 0; while($r=pg_fetch_array($q)) { $total_dur += ($dur = cal_dur($r)); $table .= "<tr><td>{$r['activity_name']}</td><td>{$r['activity_desc']}</td><td></td>$dur</tr>" } $table .= "<tr colspan=3><td>$day, $total_dur Gesamt</td></tr>" } echo "<table>$table</table>";
timings [ include: 48µs, load: 8µs, generate: 30µs, action: 7.31ms, final: 87µs, total: 7.48ms ]