Thanks Luke now I understand how to do it thanks 

 

-----Original Message-----
From: Bakken, Luke [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 27, 2005 10:22 AM
To: Gomez, Juan; beginners@perl.org
Subject: RE: Date in perl 



Hi all 
 
 
I have a problem need to work with date 
 
I have a input like these :   20050829 and I need to change it to
something like this : Aug 29 2005
 
but it still eludes me how to do that 
 
can anyone help me please?
 
---------------------------------------

I normally don't just give out answers. Next time I'm sure someone will
say "do your own homework....".

If you want to do this yourself, look at the following:

POSIX module (strftime function)
substr function.

Otherwise, look at the code below.





























use strict;
use POSIX;

my $date = 20050829;
my ($y, $m, $d) = (substr($date, 0, 4), substr($date, 4, 2),
substr($date, 6, 2));

print strftime("%a %d %Y", 0, 0, 0, $d, $m-1, $y-1900);

--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/>
<http://learn.perl.org/first-response>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to