Skip to content
Advertisement

Find How many minutes a month has: MySQL

Say I have a column

Date
23-03-2019
04-04-2019

I want to find hoe many minutes the whole month has in MySQL.

Expected output:

Date            MinsinMonth
23-03-2019       44640      
04-04-2019       43200

Advertisement

Answer

This should work:

SELECT DAY(LAST_DAY(Date)) * 1440 AS MinsinMonth

LAST_DAY returns the last day in the month a date is in

DAY Returns the day number associated to a date

1440 is the number of minutes per day (60 * 24)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement