rarebit Posted August 13, 2008 Share Posted August 13, 2008 Is this basically the easiest way to do this, or is there something built in? <?php $tim = time(); echo "time now: ".$tim."<br>"; $d = getdate($tim); $today = $d['seconds'] + ($d['minutes'] * 60) + ($d['hours'] * 3600); echo "seconds passed today: ".$today."<br>"; $start = $tim - $today; echo "start of day: ".date("l jS \of F Y h:i:s A", $start)."<br>"; ?> Cheers! Link to comment https://forums.phpfreaks.com/topic/119490-solved-the-witching-hour/ Share on other sites More sharing options...
rarebit Posted August 13, 2008 Author Share Posted August 13, 2008 Just to clarify, i'm wanting to get the start of the day, for a calender based statistics type 'thing'! Also, this seems to work, but I would have thought i'd need a 'GROUP BY date' statement at the end? $s = "SELECT SUM(date > ".$start.") as AA, SUM(date < ".$start." && date > ".($start-86400).") as BB FROM ".$tn." "; Link to comment https://forums.phpfreaks.com/topic/119490-solved-the-witching-hour/#findComment-615580 Share on other sites More sharing options...
rarebit Posted August 13, 2008 Author Share Posted August 13, 2008 Who cares? It works... Link to comment https://forums.phpfreaks.com/topic/119490-solved-the-witching-hour/#findComment-615621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.