http://qs1969.pair.com?node_id=32019


in reply to Re: Date format question
in thread Date format question

Try:
printf("%4d.%02d.%02d\n",$year+1900,$month,$day);
That is, if you don't want today's date to be printed as 100.09.11

You might want to use sprintf if you are trying to get it in a string.

Replies are listed 'Best First'.
RE: RE: Re: Date format question
by myocom (Deacon) on Sep 12, 2000 at 03:22 UTC

    Actually, you'll also want to use $month+1...

    printf("%4d.%02d.%02d\n",$year+1900,$month+1,$day);