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