in reply to date conversion

use Date::Parse; use DateTime; my $time = str2time("26/Aug/2005:01:05:43 -0400"); my $dt = DateTime->from_epoch( epoch => $time ); print $dt->ymd(''), $dt->hms(''), "Z\n";

Replies are listed 'Best First'.
Re^2: date conversion
by pg (Canon) on Aug 27, 2005 at 18:48 UTC

    Z is actually a military time zone. I am wondering whether the time zone conversion has been handled.

      The from_epoch method defaults to the UTC time zone, which is the same as "Z".

      When I just tried to install DateTime on my Windows system, there seemed to be a circular installation dependency between DateTime and DateTime::TimeZone. Just FYI.

      As an alternative to the second part of saintmike's solution, one could do:

      use Date::Parse; use POSIX; my $time = str2time("26/Aug/2005:01:05:43 -0400"); print POSIX::strftime("%Y%m%d%H%M%SZ", gmtime($time)), "\n";
        thx to all who responded.
      'Z' is actually, in the days when such zones were in common use - GMT. It is used by the military, but it is not a military time zone.

      jdtoronto