Jump to content

Last day of the month (28,29,30 or31)?


Recommended Posts

Months with 31 days are: 1, 3, 5, 7, 8, 10, 12

Months with 30 days are: 4, 6, 9, 11

If month == 2, then: 

if (year % 4 == 0)
{
	if (year % 100 == 0 && year % 400 != 0)
	{
		daysInMonth = 28;
	}
	else
		daysInMonth = 29;
}
else
	daysInMonth = 28;

 

That's what I remember...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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