You might try this:
Arguments for mktime for my reference and for yours are ...
int mktime (int hour, int minute, int second, int month, int day, int year
[, int is_dst])
Then put it together with date() like this...
date("t", mktime(1, 1, 1, $mm, 1, $yyyy));
This is untested, but should work.
--Toby
----- Original Message -----
From: "Maurice Rickard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 10:34 PM
Subject: [PHP] date("t")
> I know I can get the number of days in the current month with
> date("t"), but how would I go about getting the number of days in a
> different month?
>
> I have a form that allows users to insert a date. If the value they
> put in doesn't exist (February 31, 2001, for example), I want to
> override it. I'm already using checkdate to determine if a date is
> bad, but I'm a bit stumped on using date("t") to set a valid maximum
> for the month the user submits. (I've set up the form so that users
> will always submit a valid month, but the day is my one loose end.)
>
> Here's my code, if you'd like to make suggestions:
>
> $ver_date = checkdate($date_month, $date_day, $date_year);
>
> if ($ver_date) {
>
> $safedate = $date_year."-".$date_month."-".$date_day;
>
> } else {
>
> file://reset their date_day somehow
>
> }
>
>
> Thanks for any suggestions,
> Maurice
>
> --
> Maurice Rickard
> http://mauricerickard.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]