Sam <p...@net153.net> writes:
> 
> 
> 
> None of your arguments are right. For one, you are using the '%D' flag
> which is the same as saying '%m/%d/%y'
> 
> 
> This works fine from a quick command line test:
> 
> perl -e 'use Time::Piece; $t = "30 Oct 2018 20:53:00 -0500"; print
> Time::Piece->strptime( $t, "%d %b %Y %H:%M:%S %z" );'
> 
> 
> Wed Oct 31 01:53:00 2018
> 
> 
> But notice since you specified '%z', that that offset was added to the
> returned time... That might be what you want, or it might not be. And also
> note Time::Piece->strptime returns an object that is set to UTC whereas
> localtime->strptime returns an object not in UTC. If you really want to 
> get
> crazy with parsing times, DateTime is usually recommended: https://
> metacpan.org/pod/DateTime or just https://metacpan.org/pod/
> DateTime::Format::Strptime
> 
> 
> --Samuel Smith

        Thank you.  This turned out to be a comedy of errors on
my part.  It seems I may have stumbled across the correct way to
call the function but didn't realize it because of the wrong
arguments you saw.  I figured the %D issue out but, by that time,
I had messed around with things long enough that I forgot the ,
which separates the two arguments to that method must not be part
of the quoted string so even when the %variables were right, the
call would never work the way I had it.

        Another poster pointed this out and it now works fine.

        Thanks to all who helped.

Martin McCormick

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to