Re: [PHP] Determining number of days in a selected month

2006-01-21 Thread Geoff
Apart from using date("t", $month) you can also determine the last day of a month by getting the 0th day of the following month. Say I wanted to know the last day in Feb 2006: $mnth = 2; echo date("d",mktime(13,0,0,$mnth + 1, 0, 2006)); This is sometimes useful when you are calculating, or your

Re: [PHP] Determining number of days in a selected month

2006-01-20 Thread Jeffrey Pearson
The java mailing list I belong to recently had this same conversation. I didn't know php had that ability built in. Java doesn't (score another one for php). The cleanest solution I saw on the Java list that would be non-language specific (in other words, the same logic can be implemented i

Re: [PHP] Determining number of days in a selected month

2006-01-20 Thread tg-php
date("t") will give you the number of days in the current month. Or you can do: date("t", mktime(0, 0, 0, $month, $day, $year)) to get the number of days in a specific month in a specific year (that way you can get leap year accurate counts..) -TG = = = Original message = = = Is there a way

Re: [PHP] Determining number of days in a selected month

2006-01-20 Thread tedd
Is there a way to easily tell PHP how many days there are in a selected month without writing the following out for each month: if($Month == "January") { $NumberOfDays = 31; } elseif($Month == "February") { if($Year == "A Leap Year") { $NumberOfDays = 29; }

Re: [PHP] Determining number of days in a selected month

2006-01-20 Thread Jesús Fernández
You could also use the well known date() function to do that. Here's the doc http://www.php.net/manual/en/function.date.php Look for the format character "t", it wil give you the number of days of the month you give it as timestamp. -- Esú - http://esu.proyectoanonimo.com http://www.proyectoanon

Re: [PHP] Determining number of days in a selected month

2006-01-19 Thread clive
google- I searched for "php number of days in a month" and got this link http://www.php.net/cal_days_in_month clive Ben Miller wrote: Is there a way to easily tell PHP how many days there are in a selected month without writing the following out for each month: if($Month == "January") {