[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)



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 ?
> 

[Is this an FAQ yet? :) ]


use Time::Local;

($mday, $mon, $year) = (11, 3, 1999);             # get date - 11 March 1999

$mon -= 1;  $year -= 1900;
$time = timelocal(0, 0, 12, $mday, $mon, $year);  # convert to tm

$dow = (localtime($time))[6];                     # convert back to date



Ronald

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