Get the day of the month as a number between 1 and 31.
Return the day of the year as a number between 1 and 365 (or 1 to 366 if a leap year).
Two dates are equal if they have the same year, month, and day.
Get the first day of this Date's current month.
Example:
Date("2009-10-28").firstOfMonth => 2009-10-01
Get the beginning of this date's three month quarter
Example:
Date("2025-04-28").firstOfQuarter => 2025-04-01
Get the Jan 1st of this Date's current year.
Example:
Date("2025-10-28").firstOfYear => 2025-01-01
Return hash of year, month, and day.
Return is this date equal to today.
Return is this date equal to today + 1day.
Return is this date equal to today - 1day.
Get the last day of this Date's current month.
Example:
Date("2009-10-28").lastOfMonth => 2009-10-31
Get the end of this date's three month quarter
Example:
Date("2025-04-28").lastOfQuarter => 2025-06-30
Get the Dec 31st of this Date's current year.
Example:
Date("2025-10-28").lastOfYear => 2025-12-31
Get the month of this date.
Integer between 1 and 4 for which of the three month quarters this date falls in.
Get this Date as a Fantom expression suitable for code generation.
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
Format this date according to the specified pattern. If pattern is null, then a localized default is used. The pattern format is the same as DateTime.toLocale:
YY Two digit year 07
YYYY Four digit year 2007
M One/two digit month 6, 11
MM Two digit month 06, 11
MMM Three letter abbr month Jun, Nov
MMMM Full month June, November
D One/two digit day 5, 28
DD Two digit day 05, 28
DDD Day with suffix 1st, 2nd, 3rd, 24th
WWW Three letter abbr weekday Tue
WWWW Full weekday Tuesday
Q Quarter number 3
QQQ Quarter with suffix 3rd
QQQQ Quarter spelled out 3rd Quarter
'xyz' Literal characters
Optional
pattern: stringOptional
locale: LocaleTrap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:
a->x a.trap("x", null)
a->x() a.trap("x", null)
a->x = b a.trap("x", [b])
a->x(b) a.trap("x", [b])
a->x(b, c) a.trap("x", [b, c])
The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.
Get the day of the week for this date.
Return the week number of the year as a number between 1 and 53 using the given weekday as the start of the week (defaults to current locale).
Optional
startOfWeek: WeekdayThis method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Get the year as a number such as 2009.
Static
defDefault value is "2000-01-01".
Static
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
fromStatic
fromStatic
fromStatic
makeStatic
todayStatic
tomorrowStatic
yesterday
Date represents a day in time independent of a timezone.