Thanks to all your responses.  It works now!!

Kevin, I'll try this one as well, but for now the d instead of s works
enough!!

-----Original Message-----
From: Kevin Meltzer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 24, 2001 10:09 AM
To: Arante, Susan
Cc: [EMAIL PROTECTED]
Subject: Re: Help on Date Format


Hi Susan,

I get what you expect:

perl -wle '$y=2001;$m=4;$d=5;printf("\%s%02s%02s.doc",$y,$m,$d)';
20010405.doc

Personally, I like POSIX.pm for dates.

# perl -MPOSIX -wle 'print strftime("%Y%m%d", localtime) . ".doc"';
20010424.doc

'perldoc POSIX' to learn more (look for strftime).

Cheers,
Kevin

On Tue, Apr 24, 2001 at 11:00:40AM -0500, Arante, Susan
([EMAIL PROTECTED]) spew-ed forth:
> Could someone tell me why this is happening?  When I use this command, it
> used to give me 20010405.doc (yyyymmdd.doc), now it's giving me 2001 4
5.doc
> - I'm losing the leading zeros.  
> Command is on Perl 5 - printf("\%s%02s%02s.doc",$year,$month,$day).
> 
> Thanks.
> 

-- 
I write the music I like. If other people like it, fine, they can go buy the
albums. And if they don't like it, there's always Michael Jackson for them
to
listen to. -- Frank Zappa (about his music from the Yellow Shark)

Reply via email to