gpt4 book ai didi

perl - 从字符串中获取时间 - Perl

转载 作者:行者123 更新时间:2023-12-02 08:30:59 25 4
gpt4 key购买 nike

在 php 中你可以这样做

strtotime("+1 天");

并获取第二天的机器时间。

我想用 Perl 做同样的事情,我将做一种 cron 作业来执行某些方法。

我知道你可以使用模块 http://search.cpan.org/~gaas/HTTP-Date-6.02/lib/HTTP/Date.pm 中的 str2time我就是想不通。

我尝试了以下方法,但我不确定我是否做对了

use HTTP::Date qw(str2time);
use Time::Piece;
use Time::Seconds;

my $lol = localtime();
my $time = $lol - ONE_HOUR*($lol->hour + 24);

print "Time: " . str2time($time);

最佳答案

use Time::Piece;
use Time::Seconds;

my $t1 = localtime() + ONE_DAY;

print $t1->epoch;

关于perl - 从字符串中获取时间 - Perl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26809896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com