$dow = intval(strftime("%u")); if ($dow == 1) // monday { $monday = strtotime("today"); } else { $monday = strtotime("last monday"); } $startdate = strftime("%Y-%m-%d %H:%M", $monday); $sunday = strtotime("+6 days", $monday); $enddate = strftime("%Y-%m-%d %H:%M", $sunday); $sql = "select *, unix_timestamp(received) as receivedepoch from weekcalendar order by received"; $res = mysql_query($sql); while ($row = mysql_fetch_assoc($res)) { $date = strftime("%m/%d", $row["receivedepoch"]); $d = intval(strftime("%u", $row["received"])); $currentday = $row["received"]; print strftime("%A", $row["receivedepoch"]) . "
"; print "• {$date} Event: {$row[title]} Type: {$row[event_type]} price: {$row[price]}
\n"; } print <<