Bob-Villa
asked on
PERL - How to get 1st, 2nd, 3rd etc... Monday, Tuesday, Wednesda, etc ... date in a month
I need to find specific dates. I will always have the Month, Year and Marker.
i.e.
September, 2008.
I need to know the 'date' of the (for example) 1st Monday or 2nd Friday or whatever. Date can be in unixtime,localtime,mysql or some format that I can manipulate. Looking for pure perl or lightweight module.
i.e.
September, 2008.
I need to know the 'date' of the (for example) 1st Monday or 2nd Friday or whatever. Date can be in unixtime,localtime,mysql or some format that I can manipulate. Looking for pure perl or lightweight module.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
my $date = ymd($year, $month, $day); # for ex sep 2008 give input year = 2008 month = 9 day = 1
then,
print "Today is ";
print(('Sun','Mon','Tues',
[$date->day_of_week]);
print "day.\n"; # you will get the 1st day of week, ex. tuesday
after that its easy for you to find the date of the 1st mon or 3rd mon etc....
little tricky... but you have to write the loops accordingly...
Hope this helps...