For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > Current Date Variable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Current Date Variable
banker123

2006-10-31, 9:57 pm

I need to read the current date into a variable formatted as MMDDYY.

Example
$date=103106

Please help!

DJ Stunks

2006-10-31, 9:57 pm


banker123 wrote:
> I need to read the current date into a variable formatted as MMDDYY.
>
> Example
> $date=103106
>
> Please help!


you can use localtime() in list context to grab all the various values
of the current time (year, month, day etc) and then manipulate them
into your string, or you can use the POSIX module's strfrtime function,
or you can download a module from CPAN which would do what you like - I
would recommend Date::Format.

-jp

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com