Initializer
GregorianDateTime(Date date, Time time)
Parameters:
  • date

    Returns Date representation of current date and time.

  • time

    Returns Time representation of current date and time.

Attributes
dateSource Codeshared actual Date date

Returns Date representation of current date and time.

daySource Codeshared actual Integer day

Returns day of month value of this gregorian date.

dayOfEraSource Codeshared actual Integer dayOfEra

Returns day of year value of this gregorian date.

dayOfWeekSource Codeshared actual DayOfWeek dayOfWeek

Returns current day of the week.

dayOfYearSource Codeshared actual Integer dayOfYear

Returns day of year value of this gregorian date.

hoursSource Codeshared actual Integer hours

Number of full hours elapsed since last midnight.

leapYearSource Codeshared actual Boolean leapYear

Returns true if this is a leap year according to gregorian calendar leap year rules.

millisecondsSource Codeshared actual Integer milliseconds

Number of milliseconds since last full second.

millisecondsOfDaySource Codeshared actual Integer millisecondsOfDay

Number of milliseconds since last midnight.

minutesSource Codeshared actual Integer minutes

Number of minutes since last full hour.

minutesOfDaySource Codeshared actual Integer minutesOfDay

Number of minutes since last midnight.

monthSource Codeshared actual Month month

Returns month of this gregorian date.

predecessorSource Codeshared actual DateTime predecessor

For predecessor its used the lowest unit of time, this way we can benefit from maximum precision. In this case the predecessor is the current value minus 1 millisecond.

Refines Enumerable.predecessor ultimately refines Ordinal.predecessor
secondsSource Codeshared actual Integer seconds

Number of seconds since last minute.

secondsOfDaySource Codeshared actual Integer secondsOfDay

Number of seconds since last midnight.

stringSource Codeshared actual String string

Returns ISO-8601 formatted String representation of this Date and Time of day.

https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations

successorSource Codeshared actual DateTime successor

For successor its used the lowest unit of time, this way we can benefit from maximum precision. In this case the successor is the current value minus 1 millisecond.

Refines Enumerable.successor ultimately refines Ordinal.successor
timeSource Codeshared actual Time time

Returns Time representation of current date and time.

weekOfYearSource Codeshared actual Integer weekOfYear

Returns week of year according to ISO-8601 week number calculation rules.

yearSource Codeshared actual Integer year

Returns year of this gregorian date.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: DateTime
Attributes inherited from: DateTimeBehavior<Element,DateType,TimeType>
Attributes inherited from: Enumerable<Other>
Attributes inherited from: Ordinal<Other>
Attributes inherited from: ReadableDate
Attributes inherited from: ReadableMonth
Attributes inherited from: ReadableTime
Attributes inherited from: ReadableYear
Methods
compareSource Codeshared actual Comparison compare(DateTime other)

Comparing DateTime is based on Date and Time comparison.

instantSource Codeshared actual Instant instant(TimeZone timeZone)

DateTime does not know anything about TimeZone and it should be supplied to create a Instant.

minusSource Codeshared actual DateTime minus(ReadablePeriod amount)

Subtracts specified date period from this date and returns the new DateTime.

minusDaysSource Codeshared actual DateTime minusDays(Integer days)

Subtracts number of days from this date and returns the resulting DateTime.

minusHoursSource Codeshared actual DateTime minusHours(Integer hours)

Subtracts number of hours from this date and time and returns the resulting DateTime.

minusMillisecondsSource Codeshared actual DateTime minusMilliseconds(Integer milliseconds)

Subtracts number of milliseconds from this date and time and returns the resulting DateTime.

minusMinutesSource Codeshared actual DateTime minusMinutes(Integer minutes)

Subtracts number of minutes from this date and time and returns the resulting DateTime.

minusMonthsSource Codeshared actual DateTime minusMonths(Integer months)

Subtracts number of months from this date and returns the resulting date.

Note: Day of month value of the resulting date will be truncated to the valid range of the target date if necessary.

This means for example, that date(2013, 3, 30).minusMonths(1) will return 2013-02-28, since February 2013 has only 28 days.

minusSecondsSource Codeshared actual DateTime minusSeconds(Integer seconds)

Subtracts number of seconds from this date and time and returns the resulting DateTime.

minusWeeksSource Codeshared actual DateTime minusWeeks(Integer weeks)

Subtracts number of weeks from this date and returns the resulting DateTime.

minusYearsSource Codeshared actual DateTime minusYears(Integer years)

Subtracts number of years from this date returning the resulting the new gregorian date.

Note: Day of month value of the resulting date will be truncated to the valid range of the target date if necessary.

This means for example, that date(2012, 2, 29).minusYears(1) will return 2011-02-28, since February 2011 has only 28 days.

neighbourSource Codeshared actual DateTime neighbour(Integer offset)

The indirect successor or predecessor at the given offset, where:

  • x.neighbour(0) == x,
  • x.neighbour(i+1) == x.neighbour(i).successor, and
  • x.neighbour(i-1) == x.neighbour(i).predecessor.
offsetSource Codeshared actual Integer offset(DateTime other)

Compute the offset from the given value, where:

  • x.offset(x) == 0, and
  • x.successor.offset(x) == 1 if x!=x.successor.
periodFromSource Codeshared actual Period periodFrom(DateTime start)

Returns the period between this and the given DateTime.

If this DateTime is before the given DateTime then return negative period.

periodToSource Codeshared actual Period periodTo(DateTime end)

Returns the period between this and the given DateTime.

If this DateTime is after the given DateTime then return negative period.

plusSource Codeshared actual DateTime plus(ReadablePeriod amount)

Adds specified date period to this date and returns the new DateTime.

plusDaysSource Codeshared actual DateTime plusDays(Integer days)

Adds number of days to this date and returns the resulting DateTime.

plusHoursSource Codeshared actual DateTime plusHours(Integer hours)

Adds number of hours from this date and time and returns the resulting DateTime.

plusMillisecondsSource Codeshared actual DateTime plusMilliseconds(Integer milliseconds)

Adds number of milliseconds from this date and time and returns the resulting DateTime.

plusMinutesSource Codeshared actual DateTime plusMinutes(Integer minutes)

Adds number of minutes from this date and time and returns the resulting DateTime.

plusMonthsSource Codeshared actual DateTime plusMonths(Integer months)

Adds number of months to this date and returns the resulting date.

Note: Day of month value of the resulting date will be truncated to the valid range of the target date if necessary.

This means for example, that date(2013, 1, 31).plusMonths(1) will return 2013-02-28, since February 2013 has only 28 days.

plusSecondsSource Codeshared actual DateTime plusSeconds(Integer seconds)

Adds number of seconds from this date and time and returns the resulting DateTime.

plusWeeksSource Codeshared actual DateTime plusWeeks(Integer weeks)

Adds number of weeks to this date and returns the resulting DateTime.

plusYearsSource Codeshared actual DateTime plusYears(Integer years)

Adds number of years to this date returning the resulting gregorian date.

Note: Day of month value of the resulting date will be truncated to the valid range of the target date if necessary.

This means for example, that date(2012, 2, 29).plusYears(1) will return 2013-02-28, since February 2013 has only 28 days.

rangeToSource Codeshared actual DateTimeRange rangeTo(DateTime other)

Returns the DateTimeRange between this and given DateTime.

withDaySource Codeshared actual DateTime withDay(Integer dayOfMonth)

Returns new DateTime with the day of month value set to the specified value.

Note: It should result in a valid gregorian date.

withDayOfWeekSource Codeshared actual DateTime withDayOfWeek(DayOfWeek dayOfWeek)

Returns new DateTime with the day of week value set to the specified value.

Note: It should result in a valid gregorian date.

withDayOfYearSource Codeshared actual DateTime withDayOfYear(Integer dayOfYear)

Returns new DateTime with the day of week value set to the specified value.

Note: It should result in a valid gregorian date.

withHoursSource Codeshared actual DateTime withHours(Integer hours)

Returns new DateTime with the hours value set to the specified value.

Note: It should be a valid hour.

withMillisecondsSource Codeshared actual DateTime withMilliseconds(Integer milliseconds)

Returns new DateTime with the milliseconds value set to the specified value.

Note: It should be a valid millisecond.

withMinutesSource Codeshared actual DateTime withMinutes(Integer minutes)

Returns new DateTime with the minutes value set to the specified value.

Note: It should be a valid minute.

withMonthSource Codeshared actual DateTime withMonth(Month month)

Returns new DateTime with the month value set to the specified value.

Note: It should result in a valid gregorian date.

withSecondsSource Codeshared actual DateTime withSeconds(Integer seconds)

Returns new DateTime with the seconds value set to the specified value.

Note: It should be a valid second.

withWeekOfYearSource Codeshared actual DateTime withWeekOfYear(Integer weekNumber)

Returns new DateTime with the week of year value set to the specified value.

Note: It should result in a valid gregorian date.

withYearSource Codeshared actual DateTime withYear(Integer year)

Returns new DateTime with the year value set to the specified value.

Note: It should result in a valid gregorian date.

Inherited Methods
Methods inherited from: Object
Methods inherited from: Comparable<Other>
Methods inherited from: DateBehavior<Element>
Methods inherited from: DateTime
Methods inherited from: Enumerable<Other>
Methods inherited from: MonthBehavior<Element>
Methods inherited from: TimeBehavior<Element>
Methods inherited from: YearBehavior<Element>