sperate day,month,year from given date string

by kalai 2008-12-19 12:25:20

code to display day,month and year from given date string

$_ = '2008/12/19';
$year,$month,$day) = m<^(d{4})/(dd?)/(dd?)>;
print $month;



or another method to display day,month and year from given date string

my %date;
$_ = '2008/12/19';
@date{ qw/ year month day/} = m<^(d{4})/(dd?)/(dd?)>;
printf "%4d/%2d/%2d", @date{ qw/ year month day/};

Tagged in:

1290
like
0
dislike
0
mail
flag

You must LOGIN to add comments