lastDayOfMonth static method

DateTime lastDayOfMonth(
  1. DateTime dateTime
)

Returns DateTime that represents a beginning of the last day of the month containing date.

Example: (2020, 4, 9, 15, 16) -> (2020, 4, 30, 0, 0, 0, 0).

Implementation

static DateTime lastDayOfMonth(DateTime dateTime) {
  return previousDay(firstDayOfNextMonth(dateTime));
}