快捷搜索:  汽车  科技

php语言常用的日期函数(php时间函数汇总)

php语言常用的日期函数(php时间函数汇总)$formats = array('U' 'r' 'c' 'l F jS Y g:i A' 'H:i:s D d M y' 'm/j/y/ g:i:s a O (T)' 'Y-m-d H:i:s');echo "time(): {$time}";}$start_time = run_time();$time = time();

date_default_timezone_set('Asia/Shanghai');

function run_time(){

list($msec $sec) = explode(" " microtime());

return ((float)$msec (float)$sec);

}

$start_time = run_time();

$time = time();

echo "time(): {$time}";

$formats = array('U' 'r' 'c' 'l F jS Y g:i A' 'H:i:s D d M y' 'm/j/y/ g:i:s a O (T)' 'Y-m-d H:i:s');

foreach($formats as $format){

echo "$format: ".date($format)."\n";

}

$getdate_array = getdate($time);

echo "getdate(): ";

print_r($getdate_array);

echo "";

echo '';

$dateArray = array(

"now" "today" "tomorrow" "yesterday"

"Thursday" "this Thursday" "last Thursday"

" 2 hours" "-1 month" " 10 minutes" "30 seconds"

" 2 years -1 month" "next week" "last month"

"last year" "2 week ago" "next Friday"

php语言常用的日期函数(php时间函数汇总)(1)

php语言常用的日期函数(php时间函数汇总)(2)

猜您喜欢: