|Think about Loose Coupling|
Date formattingby ibanix (Hermit)
|on Jun 30, 2003 at 12:49 UTC||Need Help??|
ibanix has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow Monks,
I've been absent from the monstary a long time, with work and such claiming hold of my life. It's appropriate then that I have a fairly simple question to ask on my return.
I have a date field in a file of type 'MM/DD/YYYY' where MM, DD, and YYYY are month, day and year respectively. I need to convert this to 'YYYY-MM-DD'.
I think my obvious approach would be to split the field and rewrite it like so:
However, I'd really like to not reinvent well-working wheels -- is there a good date formatting function that will do this? I attempted to make localtime() do what I needed, without immediate success.
Thank you all!
$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;