Your second option works fine for me (using Time::Piece 1.31_04):
$ perl -MTime::Piece my $date_string = "Jun 03 19:49:27 2018 +0200"; my $fmt = '%b %d %H:%M:%S %Y %z'; my $time=Time::Piece->strptime( $date_string, $fmt ); print $time->strftime() ."\n"; Sun, 03 Jun 2018 17:49:27 UTC
So I guess the strptime() implementation in your O/S differs from mine. Which O/S are you using?
In reply to Re: Time::Piece and Timzone?
by hippo
in thread Time::Piece and Timzone?
by suba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |