($sec,$min,$hour,$day,$mon,$year)=localtime(time);
# 月比實際少一, 所以加 1
if (length ($mon) == 1) {$mon = '0'.$mon;}
$mon++;
# 判斷是否為個位數, 若是則在前面補 0
if (length ($mon) == 1) {$mon = '0'.$mon;}
if (length ($day) == 1) {$day = '0'.$day;}
if (length ($hour) == 1) {$hour = '0'.$hour;}
if (length ($min) == 1) {$min = '0'.$min;}
if (length ($sec) == 1) {$sec = '0'.$sec;}
# 年比實際西元年少 1900, 所以加上 1900
$year += 1900;
# 組合成完整的時間
$date = "$year$mon$day";
$time = "$hour$min$sec";
$alltime = " $date/$time";#年初、年底
$s_date = ($year-11)."$mon"."01";
$e_date = ($year-11)."$mon"."31";
沒有留言:
張貼留言