I took at the doc and it states that it comes back empty if not
valid.  So you could do something like:

@last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,5);   # start
w/ 5th wed of month
if (scalar(@last_wednesday)) { # if a value, then 5th wed exists
 }else {
  @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4);  # try
4th Wed
 }
   print @last_wednesday, "\n\n";

Wags ;)
-----Original Message-----
From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 09:06
To: [EMAIL PROTECTED]
Subject: Last Wednesday of Month



Howdy:

Can someone clue me in as to how I 
can get the last Wednesday (or whatever) 
of the month?

I have an example of what *might* work, but
I'm not sure how I can use it if, say, there 
are five  Wednesdays in the Month.  

[snip from code]
#!/usr/bin/perl -w
use strict;
use warnings;
use Date::Calc qw(:all);

my $month=(localtime())[4]+1;
my $year=(localtime())[5];
my $new_year=$year + 1900;

my @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4);
print @last_wednesday, "\n\n";

[/snip code]

In the definition of @last_wednesday, if I change ($new_year, $month, 3, 4)
to ($new_year, $month, 3, 5), it could return nothing.  I'm not sure
how to test that.

Suggestions?

Thanks!

-X


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to