RE: Displaying time in PERL

2002-08-09 Thread Scott Campbell
I'm sure someone will have an easier way, but this does it: (The $time variable will have the format you want.) #!perl $ourtime=localtime(); $ourtime=~s/ +/ /g; ($day_word,$month,$day_num,$time,$year)=split(/ /, $ourtime); print TIME: $time\n; Scott Campbell Senior Software Developer Somix

RE: Displaying time in PERL

2002-08-09 Thread Norris, Joseph
Michael, Most likely you got a ton of emails on this one - here you go Ciao! use Date::Manip; my ($mydate) = (${\ParseDate(today)} =~ /(\d{2}:\d{2}:\d{2})$/); print $mydate\n; The routine ParseDate - takes today or a variable containing a date and returns mmddhh:mm:ss I use the

RE: Displaying time in PERL

2002-08-09 Thread Bellenger, Bruno \(Paris\)
Basic code would be like this : my ($nowsec,$nowmin,$nowhour,$nowmday,$nowmon,$nowyear,$nowwday,$nowyday,$nowis dst) = localtime(time()); print $nowhour:$nowmin:$nowsec\n ; But this raw code will display for instance 14:06:02 like this 14:6:2 so here is some code that will correctly

RE: Displaying time in PERL

2002-08-09 Thread Hill, David K
PROTECTED]] Sent: Friday, August 09, 2002 8:41 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: 'Michael C. Podlesny' Subject: RE: Displaying time in PERL Basic code would be like this : my ($nowsec,$nowmin,$nowhour,$nowmday,$nowmon,$nowyear,$nowwday,$nowyday,$nowis dst) = localtime(time()); print

RE: Displaying time in PERL

2002-08-09 Thread Bellenger, Bruno \(Paris\)
/Systems Administrator -Original Message- From: Hill, David K [SMTP:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 5:49 PM To: 'Bellenger, Bruno (Paris)'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: 'Michael C. Podlesny' Subject: RE: Displaying time in PERL Or you could do

RE: Displaying time in PERL

2002-08-09 Thread Charbeneau, Chuck
From: Charbeneau, Chuck [mailto:[EMAIL PROTECTED]] Subject: RE: Displaying time in PERL printf (%02d:%02d:%02d,(localtime(time))[2,1,0]); Chuch Charbeneau ^ | But how can you trust the code from a man who can't spell his own name? Chuck Charbeneau

Re: Displaying time in PERL

2002-08-09 Thread $Bill Luebkert
Michael C. Podlesny wrote: can anyone tell me how to get the time in the format of hh:mm:ss? 1) use POSIX qw(strftime); my $time = strftime %H:%M:%S\n, localtime; 2) my $time = sprintf %02u:%02u:%02u, (localtime)[2, 1, 0]; You can replace localtime with gmtime for UTC/GMT time. -- ,-/-

RE: Displaying time in PERL

2002-08-09 Thread Bellenger, Bruno \(Paris\)
To: [EMAIL PROTECTED] Subject: RE: Displaying time in PERL printf (%02d:%02d:%02d,(localtime(time))[2,1,0]); Chuch Charbeneau ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman

RE: Displaying time in PERL

2002-08-09 Thread Charbeneau, Chuck
From: Bellenger, Bruno (Paris) [mailto:[EMAIL PROTECTED]] Subject: RE: Displaying time in PERL Shortest one so far. And not even bad on the obfuscation criteria. Well done. printf (%02d:%02d:%02d,(localtime(time))[2,1,0]); I can't take credit for it, I saw someone else use a slice

RE: Displaying time in PERL

2002-08-09 Thread Hill, David K
, Chuck [mailto:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 11:02 AM To: 'Bellenger, Bruno (Paris)'; [EMAIL PROTECTED] Subject: RE: Displaying time in PERL From: Bellenger, Bruno (Paris) [mailto:[EMAIL PROTECTED]] Subject: RE: Displaying time in PERL Shortest one so far. And not even bad