※このサンプルの解説は、「CGIの扉」をすべて読み終えてる方を前提としています。
- 【時間関数のテスト】
-
time = 1743681964
gmtime(time) = Thu Apr 3 12:06:04 2025
gmtime() = Thu Apr 3 12:06:04 2025
gmtime = Thu Apr 3 12:06:04 2025
localtime(time) = Thu Apr 3 21:06:04 2025
localtime() = Thu Apr 3 21:06:04 2025
localtime = Thu Apr 3 21:06:04 2025
(localtime)[$i] = 4 6 21 3 3 125 4 92 0
$year $mon $mday $hour $min $sec = 125 3 3 21 6 4
$fmt0 = "%04d/%02d/%02d %02d:%02d:%02d"
sprintf($fmt0, $year+1900,$mon+1,$mday,$hour,$min,$sec) = 2025/04/03 21:06:04
substr(localtime, 0, 3) = Thu