Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Coolest way to decode YYYYMMDD?

by smls (Friar)
on Jun 03, 2013 at 06:14 UTC ( #1036669=note: print w/replies, xml ) Need Help??


in reply to Coolest way to decode YYYYMMDD?

use DateTime; use List::MoreUtils qw(mesh); my $string = "19830501"; my $date = DateTime->new( mesh @{['year', 'month', 'day']}, @{[unpack "A4A2A2", $string]} );
Is that "cool" enough? :)

Replies are listed 'Best First'.
Re^2: Coolest way to decode YYYYMMDD?
by ikegami (Pope) on Jun 03, 2013 at 06:43 UTC

    You can disable a prototype rather than bending over backwards to comply to it.

    use DateTime qw( ); use List::MoreUtils qw( mesh ); my $string = "19830501"; my $date = DateTime->new(&mesh( [qw( year month day )] => [ unpack "A4A2A2", $string ] ));

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036669]
help
Chatterbox?
LanX ♪..♫ Fiesta, fiesta mexicana ... ♪..♫
[mandarin]: LanX aren't you a bit late to the party?

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-06-18 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (110 votes). Check out past polls.

    Notices?