in reply to Question regarding Time::Piece and timezones
#! /usr/bin/perl use strict; use warnings; use feature qw{ say }; use Time::Piece; my $pattern = "%a, %d %b %Y %T"; my $str = 'Wed, 13 Jan 2021 17:22:23'; local $ENV{TZ} = 'CST'; my $u1 = Time::Piece->strptime($str, $pattern); my $u2 = localtime($u1); say $_->strftime('%F %T %Z') for $u1, $u2; __END__ 2021-01-13 17:22:23 UTC 2021-01-13 17:22:23 CST
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question regarding Time::Piece and timezones
by haukex (Archbishop) on Jan 15, 2021 at 10:40 UTC | |
by Marshall (Canon) on Jan 21, 2021 at 04:01 UTC | |
by haukex (Archbishop) on Jan 22, 2021 at 14:51 UTC | |
by hippo (Archbishop) on Jan 22, 2021 at 15:13 UTC | |
by haukex (Archbishop) on Jan 22, 2021 at 16:17 UTC | |
by Marshall (Canon) on Jan 23, 2021 at 02:44 UTC | |
by Fletch (Bishop) on Jan 21, 2021 at 06:39 UTC | |
by haukex (Archbishop) on Jan 22, 2021 at 14:07 UTC | |
by Marshall (Canon) on Jan 23, 2021 at 02:03 UTC |