setlocale(LC_TIME, "fra_fra");
microtime()
如前面的 setlocale()函数定义的那样,此函数将 UNIX 时间标签格式化成适用于当前
环境的日期字符串。
应用此函数建立与当前环境兼容的日期字符串。
// get starting value
// run some code
for ($x=0; $x<1000; $x++) {
$null = $x * $x;
}
// get ending value
$end = microtime();
// calculate time taken for code execution
echo "Elapsed time: " . ($end - $start) ." sec";
?>
$start = microtime();
gmmktime($hour, $minute, $second, $month, $day, $year)
此函数由一系列用 GMT 时间表示的日期与时间值生成一个 UNIX 时间标签。不用自
变量时,它生成一个当前 GMT 即时时间的 UNIX 时间标签。
用此函数来获得 GMT 即时时间的 UNIX 时间标签。
// returns timestamp for 12:25:23 9-Jul-2006
echo gmmktime(12,25,23,7,9,2006);
?>
gmdate($format, $ts)
此函数将 UNIX 时间标签格式化成可人为阅读的日期字符串。此日期字符串以
GMT(非当地时间)表示。
用 GMT 表示时间标签时应用此函数。
// format current date into GMT
// returns "13-Sep-2005 08:32 AM"
echo gmdate("d-M-Y h:i A", mktime());