Perl localtime时间函数的应用介绍

时间:2021-05-23

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.如果要把时间保存在数据库中,可以先将其保存为字符串,然后读出时对字符串再处理。

@nowtime=localtime();
$nowstring=join(',',@nowtime);
将$nowstring保存;
读取:
@nowtime=split(',',$nowstring);

更多内容请参考:http://perldoc.perl.org/functions/localtime.html

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章