in reply to Changing format of a date.

It looks like you've got strings of a pretty simple formula, and you want other strings of a pretty simple formula. A single s/// could probably do everything you need. What have you actually tried so far?

And I know that requirements often come from outside your control, but I would advise against the MMDDYY format and stick with ISO-standard YYYY-MM-DD format. Why erase the century digits? Why use a format that will take a lot of effort to sort properly? Is 0801 supposed to be August 1 or 8 January? The ISO format takes a few more characters but gives back more in terms of readability, stability and functionality.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Re: Changing format of a date.
by nadadogg (Acolyte) on Aug 04, 2003 at 20:16 UTC
    The reason im switching to mmddyy from yyyy-mm-dd format is due to the proprietary database system i use at work, it is quite old and set in its ways, much like everything else here. I can assure you I'd love to change things up, but in my odd position, I'm given all the responsiblity in the world, and zero power or authority. I gotta basically limbo here at work, under BS deadlines, etc. and not being able to change things.
      Nobody has mentioned Time::Piece which has a nice interface to strptime and strftime:
      use Time::Piece; print localtime ->strptime('2003-08-01','%Y-%m-%d') ->strftime('%m%d%y') ;

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)