in reply to change hour in timestamp

Thank you for all the interesting answers. Another easy approach to achieve my OP:

use strict; use warnings; use Time::Piece; my $date = "Sat Jun 4 22:47:31 2022 +0200"; my $fmt = '%a %b %d %T %Y %z'; my $tp = Time::Piece->strptime($date, $fmt); print $tp;

I agree with the mention that I should work with timezone though.