Jump to content

[SOLVED] The witching hour!


rarebit

Recommended Posts

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

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." ";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.