Re: date("t")

From: Date: Fri, 19 Jan 2001 03:47:11 +0000
Subject: Re: date("t")
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35553@lists.php.net to get a copy of this message
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" <maurice@mauricerickard.com> To: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#35553) next »