Created
August 30, 2013 06:57
-
-
Save Fabax/6386973 to your computer and use it in GitHub Desktop.
return today's midnight timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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