in reply to Getting Day Of Month

One way is to install Date::Manip. Then, extract out the month, day, and year with a regex. Create an array with the days of the week.
use Date::Manip; my @dayOfWeek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Sat +urday); my ( $month, $day, $year ) = ( 5, 25, 2002 ); my $day = &Date_DayOfWeek( $month, $day, $year ); print $dayOfWeek[ $day ];
And no doubt somebody is going to look that date up and say that it is not a Monday... =8-)
According to Date::Manip, it's a Saturday :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: Getting Day Of Month
by danger (Priest) on Jan 03, 2001 at 01:22 UTC

    An alternative to Date::Manip is the Date::Calc module which also provides hordes of date utility functions (and it is a C lib so it is fairly quick).

    #!/usr/bin/perl -w use strict; use Date::Calc qw/Day_of_Week/; my @days = qw/Sunday Monday Tuesday Wednesday Thursday Friday Saturday/; my $dow = $days[ Day_of_Week(2002, 5, 25) ]; print "$dow\n"; __END__

    Several have mentioned simple ways to do it yourself, but if you need more date manipulation than your post suggests (things like differences between dates, business days, etc), I recommend checking out one of the modules -- it isn't hard to work with dates, but it isn't hard to work with dates incorrectly either :-)