[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How do I find the day of the week from a given date (NOT today)



On Thu, 11 Mar 1999, Lars G. Skjellerup wrote:

> I have a small problem (Yet again). How can I find the day of the week
> from a given date, which is not the date today. If it was the date now
> it is real easy.
> 
> Are there some pearl functions other than localtime(),time() - that
> might be helpful ? Or do I have to construct my own ?
> 
There is always the monolithic, all-capable Date::Manip module. :-)

I don't use it myself, so the following is a cobble, and parts may be
round-about, but it works:

#!perl -w

use Date::Manip; 

$date=&ParseDateString("15 Mar 1999");
$unixdate = &UnixDate($date, "%m %d %y");
($m, $d, $y) = split(/ /,$unixdate);
$day=&Date_DayOfWeek($m,$d,$y); 

@daynames = ("","Mon","Tue","Wed","Thu","Fri","Sat","Sun"); 
print "Day = $daynames[$day]\n";

__END__



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org