Skip to content

Instantly share code, notes, and snippets.

@Fabax
Created August 30, 2013 06:57
Show Gist options
  • Save Fabax/6386973 to your computer and use it in GitHub Desktop.
Save Fabax/6386973 to your computer and use it in GitHub Desktop.
return today's midnight timestamp
function getMidnight(){
$date = new DateTime();
$hours = $date->format('H');
$minutes = $date->format('i');
$seconds = $date->format('s');
$hours = ($hours*60)*60;
$minutes = $minutes*60;
$midnight = time()-($hours+$minutes+$seconds);
$midnight = $date = date('Y-m-d H-i-s', $midnight);
return $midnight;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment