Dates extension

Provides low-level functions for working with dates.

These functions should only be used when it is not feasible to use sugar.time, such as when working with 3rd-party date-time types.

on
  • Never

Static Methods

dayOfYear(int year, int month, int day) int
Computes the ordinal day of the year.
daysInMonth(int year, int month) int
Computes the number of days in the given month taking leap years into account.
format(int year, [int month = 1, int day = 1]) String
Formats the date as a ISO-8601 date.
leapYear(int year) bool
Returns true if the year is a leap year.
weekday(int year, int month, int day) int
Computes the ordinal day of the week.
weekOfYear(int year, int month, int day) int
Computes the ordinal week of the year.