Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit Format of Date Field in Perl

Status
Not open for further replies.

canguro

Programmer
Sep 15, 2002
57
US
Hello,

I am creating output records which contain a date field in the format MON-DD-YY, for example Apr-11-03, but I need to change it to the format MM/DD/YYYY, i.e. 04/11/2003. I have looked into the Date:Manip module documentation, but I am not seeing how to do it. I must be missing something. Perhaps there is another module which can perform the edit?

If someone could advise it would be greatly appreciated, since I don't know how to proceed. Many thanks.

Joe
 
- remember to add this to your code:

use Date::Calc qw(Decode_Month);
 
chazoid,

Thank you for the prompt reply. I did a prelim 'run' with the code you suggested, i.e. use Date::Calc qw(Decode_Month); it seems that Perl says "Can't locate Date/Calc.pm in @INC (@INC contains: . C:/Perl/lib C:/Perl/site/lib .)"

I have Win 2k and I got my Perl 5.8 thru ActiveState. I assume that I need to download Date::Calc module from CPAN, and that it should be placed in the Perl lib shown above? I've never done a download/install. Can you advise on the install process?

Thanks again for your help.

Joe
 
You can just use the perl package manager.. At the command prompt, type this:

C:\>PPM install date-calc

this will download the module from activestate and install it. It should also update the html documentation - typically located at C:\Perl\html\index.html

I hope this helps.. good luck!
 
chazoid,

Thank you very much. It installed without any problem.

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top