Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Converting datetime string to valid localtime value (seconds)

by hippo (Chancellor)
on Oct 30, 2018 at 09:14 UTC ( #1224905=note: print w/replies, xml ) Need Help??


in reply to Re: Converting datetime string to valid localtime value (seconds)
in thread Converting datetime string to valid localtime value (seconds)

Alternatively, don't parse the monthnames yourself and use the core module Time::Piece instead:

#!/usr/bin/env perl use strict; use warnings; use Time::Piece; my $source = 'Mon Oct 29 15:59:06 2018'; my $time = Time::Piece->strptime ($source, '%a %b %d %T %Y'); # Now use it however you wish print $time->datetime . "\n"; print "Today is " . $time->fullday . "\n";
  • Comment on Re^2: Converting datetime string to valid localtime value (seconds)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1224905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-07-06 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?