Re: localtime question - zero padding - mnth discrepancy

2002-12-16 Thread John W. Krahn
Harry Putnam wrote: > > "John W. Krahn" <[EMAIL PROTECTED]> writes: > > > printf " %02d/%02d/%04d %02d:%02d:%02d\n", $lta[4] + 1, $lta[3], $lta[5] + 1900, >@lta[2,1,0]; > > Thanks.. the tips work good. And I overlooked the part about mnths > being 0-11. > > I get the idea from your posted pri

Re: localtime question - zero padding - mnth discrepancy

2002-12-16 Thread Harry Putnam
Toby Stuart <[EMAIL PROTECTED]> writes: > Check the length of second, minute and hour. > If the length == 1 then add a leading zero eg. $sec = "0" . $sec > Maybe there is some other "magical" way of doing this, if there is i'm not > aware of it :) Good idea... thanks. "John W. Krahn" <[EMAIL P

Re: localtime question - zero padding - mnth discrepancy

2002-12-15 Thread John W. Krahn
Harry Putnam wrote: > > I really have two questions here: > > 1) How can I get padded numbers in the single digit range in this >script? perldoc -f sprintf perldoc -f printf perldoc POSIX# look for the strftime function > 2) Hoping tbis isn't some glaring mistake and I'm too blind to s

FW: localtime question - zero padding - mnth discrepancy

2002-12-15 Thread Toby Stuart
> -Original Message- > From: Toby Stuart [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 16, 2002 4:17 PM > To: '[EMAIL PROTECTED]' > Subject: RE: localtime question - zero padding - mnth discrepancy > > > > > > -Original Message

RE: localtime question - zero padding - mnth discrepancy

2002-12-15 Thread Toby Stuart
> -Original Message- > From: Harry Putnam [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 16, 2002 3:15 PM > To: [EMAIL PROTECTED] > Subject: localtime question - zero padding - mnth discrepancy > > > > I really have two questions here: > > 1) Ho

localtime question - zero padding - mnth discrepancy

2002-12-15 Thread Harry Putnam
I really have two questions here: 1) How can I get padded numbers in the single digit range in this script? 2) Hoping tbis isn't some glaring mistake and I'm too blind to see it. Notice how the month is off by 1 cat test.pl #!/usr/local/bin/perl -w $now = time; ## 1 day = 86400