/*
Convert Day date to time stamp
Strtotime (time,now) parameter description
Time to specify the string to parse.
Now is the time stamp used to calculate the return value. If this argument is omitted, the current time is used.
<?php
Echo Strtotime ("Now"), "";
Echo Strtotime ("September 2000"), "";
Echo strtotime ("+1 Day"), "";
Echo strtotime ("+1 Week"), "";
Echo strtotime ("+1 Week 2 days 4 hours 2 Seconds"), "";
Echo Strtotime ("next Thursday"), "";
Echo Strtotime ("Last Monday"), "";
?>
<?php
$str = ' not good ';
Previous to PHP 5.1.0 you would compare with-1, instead of false
if (($timestamp = Strtotime ($str)) = = False) {
echo "The string ($STR) is bogus";
} else {
echo "$str = =". Date (' l DS o F Y h:i:s A ', $timestamp);
}
?>
And look at the strtotime example
*/
echo strtotime (' 2010-2-14 '), "<br/>";
echo Date (' y-m-d ', strtotime (' 2010-2-14 '));
Output value
1266076800
2010-02-14
You should be in Strtotime (), and you decide what you can't do. For example
<?php
# on 2/8/2010
Date (' m/d/y ', Strtotime (' Day ')); # 02/01/10
Date (' m/d/y ', Strtotime (' Last Day ')); # 02/28/10
Date (' m/d/y ', Strtotime (' Last day next month '); # 03/31/10
Date (' m/d/y ', Strtotime (' Last day month ')); # 01/31/10
Date (' m/d/y ', Strtotime (' 2009-12 last Day ')); # 12/31/09-this doesn ' t work if you reverse the order of the Year and month
Date (' m/d/y ', Strtotime (' 2009-03 last Day ')); # 03/31/09
Date (' m/d/y ', strtotime (' 2009-03 ')); # 03/01/09
Date (' m/d/y ', Strtotime (' Last day of March 2009 ')); # 03/31/09
Date (' m/d/y ', Strtotime (' Last day of March ')); # 03/31/10
?>