Hi Bryan,

> > $t = mktime(0,0,0,date('m')+1,1,date('Y'));
> > 
> > Gives you timestamp of first day, next month. 
> > Format accordingly with date().
>
> is there such a say to now get the date of the first
> weekday after that date?

You can brute force it:

// grab the timestamp
$t = mktime(0,0,0,date('m')+1,1,date('Y'));

// if it's a saturday or sunday, add 86400 seconds (1 day)
while (date('w',$t) == 0 || date('w',$t) == 6)
  $t += 86400;

This doesn't take into account any bank holidays, of course - you'll need to
do a lookup against a database or an array if you want to test for these as
well (not sure if you want the first weekday or the first working day).

There might be a more elegant way to do this, but with a maximum of three
iterations round the while loop, I don't know if it's worth looking for :-)

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to