Jump to content

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

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.