in reply to Converting dates with Date:Format

Strftime takes the return value of localtime function which tmpdate doesnt match

Replies are listed 'Best First'.
Re^2: Converting dates with Date:Format
by ultranerds (Hermit) on Jan 10, 2017 at 07:36 UTC
    Ahhh ok - yeah that makes sense. Is there a better way to change from one format to another? Seems a bit long winded to have to convert one string into a localtime(), then to epoch, and then back again into another format

    Thanks!
      use Time::Piece; my $t = Time::Piece->strptime( '2008-11-03 20:15:44',"%Y-%m-%d %H:%M:%S" ); print $t->strftime("%a, %d %b %Y %H:%M:%S %Z");
      poj
        You legend! Works like a charm! Thanks :)