How do you know how many days are in the current month?

Asked

Viewed 1,926 times

6

How to know how many days is the current month Mysql, example: setembro = 30dias

Motive:

I have a goal : exemplo: 1.000,000

I need to take the value of the goal and divide by the amount of days you have in the current month to return the value of the daily goal.

  • And the basic information to find the last day comes from where?

3 answers

7


5

In this context it would use two functions, the CURDATE() to know the date of the day and the LAST_DAT() which returns the last day of the month from a date.

SELECT LAST_DAY( CURDATE() ) as DIAS_MES

KURDISH() - Documentation

LAST_DAY() - Documentation

2

Just supplementing the information, how the friend wants the number of days.

SELECT DAY(LAST_DAY( data_field )) as DIAS_MES;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.