1. 一般使用:
@nowtime=localtime();
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
注意:
$mon+1,$year+1900;
$now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
2.如果要把時(shí)間保存在數(shù)據(jù)庫(kù)中,可以先將其保存為字符串,然后讀出時(shí)對(duì)字符串再處理。
@nowtime=localtime();
$nowstring=join(',',@nowtime);
將$nowstring保存;
讀取:
@nowtime=split(',',$nowstring);
更多內(nèi)容請(qǐng)參考:http://perldoc.perl.org/functions/localtime.html
新聞熱點(diǎn)
疑難解答
圖片精選