in reply to Re: is today a friday
in thread is today a friday

Thanks for the start izut. Is there any way to pass in a date without having to count the number of days that have passed since epoch? is there any way to just pass in "03102006" (today's date).

Replies are listed 'Best First'.
Re^3: is today a friday
by ikegami (Patriarch) on Mar 10, 2006 at 19:51 UTC
    Some or all of the modules already listed do this. Core module Time::Local also does.
    use Time::Local qw( timelocal ); my $date = '10/15/2008'; my ($m, $d, $y) = split(m{/}, $date); my $time = timelocal(0, 0, 0, $d, $m-1, $y); my $dow = (localtime($time))[6]; if ($dow == 5) { print("It's Friiiiiiiiday!\n"); } elsif ($dow == 0 || $dow == 6) { print("Sweet heavenly weekend!\n"); } else { print("Get back to work, you bum!\n"); }
Re^3: is today a friday
by kwaping (Priest) on Mar 10, 2006 at 19:49 UTC
    Well, you could use Mktime in Date::Calc to convert your string to unix time, then pass that to another Date::Calc function... but what's the point? Just use one of Date::Calc's Day_of_Week methods and be done with it.
    ---
    It's all fine and dandy until someone has to look at the code.