Jump to content

[SOLVED] number of days in month


corillo181

Recommended Posts

@hostfreak

 

//defined month July

echo date("t", mktime(0, 0, 0, 7, 0, 0));

 

Day 0 of a month is actually the last day of the previous month, so the code above gives 30 - the number of days in June.

 

Use

//defined month July
echo date("t", mktime(0, 0, 0, 7, 1, 0));

BTW that does give an alternative way of getting the number of days in June, rather than July.

 

i.e. get day for day 0 of following month

 

<?php

//defined month June

echo date("d", mktime(0, 0, 0, 7, 0, 0));

 

?>

I'm sure you didn't mean to get these results

 

For the year 2007

January has 31 days

February has 31 days

March has 28 days

April has 31 days

May has 30 days

June has 31 days

July has 30 days

August has 31 days

September has 31 days

October has 30 days

November has 31 days

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.