Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Very simple way to get the number of seconds from Jan 1, 0001 or any other date
- * the normal date/time functions only work from 1 Jan 1970
- * Requires PHP 5.3 or above
- * Start: must be in YYYY-MM-DD format
- * End: must be in YYYY-MM-DD format
- */
- function seconds_since($start='0001-01-01',$end=date(Y-m-d))
- (
- $datetime1 = new DateTime($start);
- $datetime2 = new DateTime($end);
- $interval = $datetime1->diff($datetime2);
- return $interval->format('%a') * 24 * 60 * 60;
- }
- ?>
Add Comment
Please, Sign In to add comment