DateTimeExpressions extension Null safety

Provides expressions to extract information from date time values, or to calculate the difference between datetimes.

on

Properties

date Expression<String>
Formats this datetime in the format year-month-day.
read-only
datetime Expression<String>
Formats this datetime in the format year-month-day hour:minute:second.
read-only
day Expression<int>
Extracts the day from this datetime expression.
read-only
hour Expression<int>
Extracts the hour from this datetime expression.
read-only
julianday Expression<double>
Formats this datetime in the Julian day format - a fractional number of days since noon in Greenwich on November 24, 4714 B.C.
read-only
minute Expression<int>
Extracts the minute from this datetime expression.
read-only
month Expression<int>
Extracts the month from this datetime expression.
read-only
second Expression<int>
Extracts the second from this datetime expression.
read-only
secondsSinceEpoch Expression<int>
Returns an expression containing the amount of seconds from the unix epoch (January 1st, 1970) to this datetime expression.
@Deprecated('Use the `unixepoch` getter instead')read-only
time Expression<String>
Formats this datetime in the format hour:minute:second.
read-only
unixepoch Expression<int>
Formats this datetime as a unix timestamp - the number of seconds since 1970-01-01 00:00:00 UTC.
read-only
year Expression<int>
Extracts the year from this datetime expression.
read-only

Methods

modify(DateTimeModifier modifier) Expression<DateTime>
Apply a modifier that alters the date and/or time.
modifyAll(Iterable<DateTimeModifier> modifiers) Expression<DateTime>
Applies modifiers that alters the date and/or time.
strftime(String format) Expression<String>
Formats this datetime according to the format string specified as the first argument. The format string supports the most common substitutions found in the strftime() function from the standard C library plus two new substitutions, %f and %J. The following is a complete list of valid strftime() substitutions:

Operators

operator +(Duration duration) Expression<DateTime>
Adds a duration to this date.
operator -(Duration duration) Expression<DateTime>
Subtracts duration from this date.

Static Methods

fromUnixEpoch(Expression<int> unixEpoch) Expression<DateTime>
Converts a numeric expression unixEpoch into a date time by interpreting it as the amount of seconds since 1970-01-01 00:00:00 UTC.