firstDayOfYear static method

DateTime firstDayOfYear(
  1. DateTime dateTime
)

Returns DateTime that represents a beginning of the first day of the year containing date.

Example: (2020, 3, 9, 15, 16) -> (2020, 1, 1, 0, 0, 0, 0).

Implementation

static DateTime firstDayOfYear(DateTime dateTime) {
  return _date(dateTime.isUtc, dateTime.year, 1, 1);
}