[prog] Dates in Perl
Katherine Spice
k.spice at acu.ac.uk
Fri Aug 22 10:13:24 EST 2003
Dan Richter wrote:
> I'm all for quick-and-dirty in this case.
My speciality :-) I'd suggest backticks and the system date function.
You can man date for more formatting options, but the examples you
provide can be solved like so:
# date -d 2003-12-31 +"%d %b %Y"
31 Dec 2003
# date -d "31 Dec 2003" +"%F"
2003-12-31
In your program just use something like:
$olddate = '2003-12-31';
$newdate = `date -d $newdate +"%d %b %Y"`;
HTH,
Katherine
More information about the Programming
mailing list