Home » » strtotime

strtotime

Written By 1 on Sunday, September 30, 2012 | 8:35 AM

int strtotime ( string $time [, int $now = time() ] )

Parse about any English textual datetime description into a Unix timestamp


<?php
echo strtotime("now"), "\n";
echo 
strtotime("10 September 2000"), "\n";
echo 
strtotime("+1 day"), "\n";
echo 
strtotime("+1 week"), "\n";
echo 
strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo 
strtotime("next Thursday"), "\n";
echo 
strtotime("last Monday"), "\n";
?>

5.3.0 Prior to PHP 5.3.0, 24:00 was not a valid format and strtotime() returned FALSE. 5.2.7 In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month would incorrectly add one week to the returned timestamp. This has been corrected in 5.2.7 and later versions. 5.1.0 Now returns FALSE on failure, instead of -1. 5.1.0 Now issues the E_STRICT and E_NOTICE time zone errors. 5.0.2 In PHP 5 up to 5.0.2, "now" and other relative times are wrongly computed from today's midnight. This differs from other versions where it is correctly computed from current time. 5.0.0 Microseconds began to be allowed, but they are ignored. 4.4.0 In PHP versions prior to 4.4.0, "next" is incorrectly computed as +2. A typical solution to this is to use "+1".


Format Date and Insert Into Database Table: PHP

0 Comment:

Post a Comment