Dear Timothy! Sorry I didn't want to critisize anybody, it's true that localtime mostly works, but I've also seen some cases, where so strange things happened...
We've been using localtime for over 4 years. My example: On Red hat 7.1 perl v5.6.0 localtime sometimes dropped the daylight saving time and sometimes it didn't. we really didn't manage to find out why this sometimes occured... and it wasn't only one server / case. I wouldn't recommend it, if you have a lot to do with time zones. Otherwise it worked fine! -----Urspr�ngliche Nachricht----- Von: Timothy Johnson [mailto:tjohnson@;sandisk.com] Gesendet: Mittwoch, 13. November 2002 09:06 An: 'Denis Banovic '; ''Gerardo Carvallo Velasco' '; '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] ' Betreff: RE: How can I get the date of today in perl With all due respect, unless you have a specific case where the localtime() function does not work, this advice is basically useless. localtime() has never failed me or anyone I've ever spoken with, and I use it in every script I write. If you do know of a specific instance in which localtime() will steer you wrong, please let us know, but so far you've just done a lot of shouting. -----Original Message----- From: Denis Banovic To: 'Gerardo Carvallo Velasco'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 11/12/02 11:37 PM Subject: AW: How can I get the date of today in perl Hi Folks! Please don't use localtime Function!!! sooner or later, you'll get BURNED!!! sometimes it just returns different date/time, or it returns nothing at all. And I'm not running under Mod_Perl! Use one of the Modules available on CPAN Class::Date is my favorite! you can do a lot of useful converting, calculating aso... Denis Banovic "THINK THE WEB WAY." --------------------------------------------------- NCM - NET COMMUNICATION MANAGEMENT GmbH ---[ Denis Banovic - CTO mailto:denis.banovic@;ncm.at ---[ M�hlstrasse 4a AT - 5023 Salzburg Tel. 0662 / 644 688 ---[ Fax: 0662 / 644 688 - 88 http://www.ncm.at --------------------------------------------------- -----Urspr�ngliche Nachricht----- Von: Gerardo Carvallo Velasco [mailto:gerardo_carvallo@;hotmail.com] Gesendet: Dienstag, 12. November 2002 18:42 An: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: RE: How can I get the date of today in perl Puedes Utilizar una subrutina como esta: sub getDate{ my $time = time() + ($time_zone * 3600); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($time); #Agrega digitos para a�o 2000 $year += ($year < 90) ? 2000 : 1900; my $am = "AM"; $am = "PM" if($hour>12); $hour -= 12 if($hour>12); my $mins = sprintf("%02d:%02d %s",$hour,$min,$am); $dateNumber = sprintf("%02d/%02d/%04d %s",$mon+1,$mday,$year,$mins); $dateShort = sprintf("%02d/%02d/%04d",$mon+1,$mday,$year); my @RealDay = ("Domingo","Lunes","Martes","Mi�rcoles", "Jueves","Viernes","S�bado"); my @RealMonth = ("Enero","Febrero","Marzo","Abril","Mayo","Junio", "Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); my $daweek = $RealDay[$wday]; # Monday, Tuesday, etc. my $month = $RealMonth[$mon]; # January, February, etc. $dateString ="$daweek $mday de $month del $year $mins"; } Atentamente Gerardo Carvallo V. >From: "Spitzer, Robert \(T05\)" <[EMAIL PROTECTED]> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>, >[EMAIL PROTECTED], >[EMAIL PROTECTED], >[EMAIL PROTECTED] >Subject: RE: How can I get the date of today in perl >Date: Tue, 12 Nov 2002 08:03:22 -0500 > >You can grab the individual items out of localtime by doing something like: > >($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); > > >Rob Spitzer > > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:Cai_Lixin@;emc.com] >Sent: Monday, November 11, 2002 5:51 PM >To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; >[EMAIL PROTECTED]; >[EMAIL PROTECTED] >Subject: How can I get the date of today in perl > > >It looks like localtime() function returns both Date and time, I only want >to get date. How can I do that in perl? > >Thanks > >Lixin >_______________________________________________ >Perl-Win32-Admin mailing list [EMAIL PROTECTED] >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs >_______________________________________________ >Perl-Win32-Admin mailing list >[EMAIL PROTECTED] >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs You _________________________________________________________________ MSN Fotos: la forma m�s f�cil de compartir e imprimir fotos. http://photos.msn.es/support/worldwide.aspx _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
