지식블랙홀 2009. 1. 20. 19:39

strtotime ( string time [, int now])
버       전 PHP 3>= 3.0.12, PHP 4
기       능 영문자열로 주어진 날짜/시간에 대한 timestamp를 돌려준다.
설       명 예 1.
strtotime() 예제
<?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";
?>
 

예 2. 체킹실패 예제
<?php
$str = 'Not Good';
if (($timestamp = strtotime($str)) === -1)
{
   echo "The string ($str) is bogus";
} else {
   echo "$str == " . date('l dS of F Y h:i:s A', $timestamp);
}
?>