In article 
<[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]>,
 zze-CHOQUET wrote:

> I have a problem with a date conversion. I wanted to get the day of the week
> and the time corresponding to an amount of seconds since the beginning of
> year 1970. I have used the Date::Manip module and the commands:
>           $temp=localtime($elapsedtime);
>           $day=&UnixDate($temp,"%a");
>           $hour=&UnixDate($temp,"%T");
> which gives me the right results but are _very_ slow. I would like to find
> another way to do the conversion, which would be faster.I have tried to look
> through the Date::Calc module but have found nothing.

See perldoc -f localtime.  You don't need to use a big ol' module for 
all that.

   my %days = qw(0 Sun 1 Mon 2 Tue 3 Wed 4 Thu 5 Fri 6 Sat);
   my @temp = localtime($elapsedtime);
   printf "%s, %2d:%2d:%2d\n", $days{$temp[6]}, @temp[2, 1, 0];

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to