in reply to change hour in timestamp

> This is not a DateTime object.

DateTime says

I searched around in metacpan and found Date::Parse and the Synopsis seems to do the job well, at least for epoch

use strict; use warnings; use Data::Dump qw/pp dd/; use Date::Parse; use DateTime; pp my $date = 'Sat Jun 4 22:47:31 2022'; pp my $time = str2time($date); pp my ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($date); my $dt = DateTime->from_epoch ( epoch => $time, time_zone => 'UTC', # fill in your timezone ); print $dt;

"Sat Jun 4 22:47:31 2022" 1654375651 (31, 47, 22, 4, 5, 122, undef) 2022-06-04T20:47:31

Other modules - especially the one suggested by 1nickt - might be better, I just wanted to demonstrate how to solve it by yourself.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery