Gerardo wrote..
>Puedes Utilizar una subrutina como esta:
>
>sub getDate{
>
>my $time = time() + ($time_zone * 3600);
^^^^^^^^^^^^^^^^^^^^^
I hope that $time_zone is always zero for you, otherwise this will break
your calculations. The timezone calculation is precisely what the
localtime() function does for you. You don't need to do this.
>my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($time);
>#Agrega digitos para a�o 2000
>$year += ($year < 90) ? 2000 : 1900;
^^^^^^^^^^^^^^^^^^^
(localtime)[5] is the number of years since 1900, and always has been (and
presumedly) always will be, all you need is:
$year += 1900;
As explained in the perlfunc section of the manual.
>my $am = "AM";
>$am = "PM" if($hour>12);
>$hour -= 12 if($hour>12);
If you want to do things this way then it is also customary to do:
$hour = 12 if $hour == 0;
So that you get 12:01 AM at a minute past midnight instead of the
24-hour/12-hour merge of 00:01 AM that your code produces.
>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";
>
>}
--
Jason King
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs