in reply to change hour in timestamp
The Time::Piece module, along with its associated Time::Seconds module for date calculations, is core.
johngg@abouriou:~/perl/Monks$ perl -Mstrict -Mwarnings -MTime::Piece - +MTime::Seconds -E 'say q{}; my $date = q{Sat Jun 4 22:47:31 2022}; my $tp = Time::Piece->strptime( $date, q{%a %b %d %T %Y} ); $tp -= ONE_HOUR; $tp -= ONE_HOUR; say $tp->strftime();' Sat, 04 Jun 2022 20:47:31 UTC
I hope that this is helpful.
Cheers,
JohnGG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: change hour in timestamp
by kcott (Archbishop) on Jun 05, 2022 at 00:54 UTC |
In Section
Seekers of Perl Wisdom