e janssens Posted February 7 Report Share Posted February 7 Has someone a function which results in the number of the last day of this month? it can be 28,29,30 or 31 I need it as indexinput for an indexed table, to now the month is finished. Quote Link to comment Share on other sites More sharing options...
Saragani Posted February 7 Report Share Posted February 7 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... Quote Link to comment Share on other sites More sharing options...
e janssens Posted February 8 Author Report Share Posted February 8 Thanks Staff, this is in fact easy. Quote Link to comment Share on other sites More sharing options...
pascal Posted April 2 Report Share Posted April 2 I had a similar "problem" I made a calendar as a indexed table, with 366 days (so it's always a leap year) to know the index of the current day, I take the day of the month and add a fixed value corresponding the actual month..... so if we are may 2, then I add 91 minus 1 and my index in my data table is 92.... used a switch case.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.