develooper Front page | perl.beginners | Postings from February 2002

Date::Calc date returned format

Thread Next
From:
patrick.kenneally
Date:
February 7, 2002 04:04
Subject:
Date::Calc date returned format
Message ID:
H00000a509ae53db@MHS
All,
	using the following code under W2K Activestate v5.6.1 (629), I get the 
date output as : 20 days ago, it was 20020118

I would like to drop the leading '20' in 2002 so it would read: 20 days ago, it 
was 020118. I know I could just rip it out but I would like to know how to 
return the date from the module in 2 digit year format.

Thanks in advance,
Patrick

	**************************

use Date::Calc qw( :all );

  ($year, $month, $day) = Add_Delta_Days (Today, -20);

printf "20 days ago, it was %02d%02d%d\n", $year, $month, $day;


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About