Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time data
Date and time date
Extracting dates and times
Doing arithmetic with dates
31. The EOMONTH() function
Converting date and time data
Building date and time data from parts
Summary and review

Instruction

Perfect! The final arithmetic function we'll discuss is EOMONTH() (end of month):

EOMONTH(startDate, monthToAdd)

The EOMONTH() function with just startDate argument passed returns the end of the current month. With the second argument passed (monthToAdd), it'll do the same but first it'll find the month which is monthToAdd months ahead. For example:

SELECT
  EOMONTH(ProducedDate)
FROM Aircraft;

This gives us the last day of the month when each aircraft was produced.

Exercise

Show the last day of the month for each entry in the Date column of the Flight table. Name the column DateEnd.