Skip to contents

A plain_date_time() is a calendar date in the ISO 8601 calendar with a time of day to the nanosecond and no time zone, stored as a complex vector whose real part is the epoch day and whose imaginary part is the nanoseconds of day. The constructor is Temporal.PlainDateTime and Temporal.PlainDateTime.from() in one: it reads fields, strings or another zutempo value.

Usage

plain_date_time(
  year,
  month = NULL,
  day = NULL,
  hour = 0,
  minute = 0,
  second = 0,
  millisecond = 0,
  microsecond = 0,
  nanosecond = 0,
  ...,
  month_code = NULL,
  overflow = "constrain"
)

plain_date_time_compare(x, y)

Arguments

year

The year, or a string in ISO 8601 form ("2026-01-31T12:30:45.5", a date alone for midnight, an offset is ignored and Z is rejected), or a plain_date_time(), plain_date() (for midnight), zoned_date_time(), Date (for midnight), POSIXct or POSIXlt value to convert. A zoned or POSIXt value gives its wall-clock time in its own zone.

month, day

The month (1 to 12) and day of the month, when year is a number. month may be replaced by month_code.

hour, minute, second, millisecond, microsecond, nanosecond

The time fields, 0 by default.

...

Must be empty.

month_code

The month as "M01" to "M12", instead of month.

overflow

"constrain" (the default) clamps each field to its range, "reject" raises a zutempo_range_error.

x, y

plain_date_time() values or strings, for plain_date_time_compare().

Value

A plain_date_time() vector; plain_date_time_compare() returns an integer vector of -1, 0 and 1.

Details

Values may lie up to a day beyond the range of a plain_date(), from just after -271821-04-19T00:00 to the end of +275760-09-13. A result outside that range is a zutempo_range_error, never NA.

Members

Every member of Temporal.PlainDateTime in the pinned specification (inst/spec/PINS) and the R function that implements it:

TemporalR
new Temporal.PlainDateTime()plain_date_time()
Temporal.PlainDateTime.from()plain_date_time()
Temporal.PlainDateTime.compare()plain_date_time_compare()
.calendarIdcalendar_id()
.eraera()
.eraYearera_year()
.yearyear()
.monthmonth()
.monthCodemonth_code()
.dayday()
.hourhour()
.minuteminute()
.secondsecond()
.millisecondmillisecond()
.microsecondmicrosecond()
.nanosecondnanosecond()
.dayOfWeekday_of_week()
.dayOfYearday_of_year()
.weekOfYearweek_of_year()
.yearOfWeekyear_of_week()
.daysInWeekdays_in_week()
.daysInMonthdays_in_month()
.daysInYeardays_in_year()
.monthsInYearmonths_in_year()
.inLeapYearin_leap_year()
.with()temporal_with()
.withPlainTime()temporal_with_plain_time()
.withCalendar()temporal_with_calendar()
.add()temporal_add()
.subtract()temporal_subtract()
.until()temporal_until()
.since()temporal_since()
.round()temporal_round()
.equals()temporal_equals()
.toString()temporal_to_string()
.toLocaleString()none: ECMA-402 (locale formatting) is out of scope
.toJSON()none: format() covers it
.valueOf()none: throws in JavaScript; no R counterpart
.toZonedDateTime()temporal_to_zoned_date_time()
.toPlainDate()temporal_to_plain_date()
.toPlainTime()temporal_to_plain_time()

Examples

plain_date_time("2026-01-31T12:30:45.5")
#> <zutempo_plain_date_time[1]>
#> [1] 2026-01-31T12:30:45.5
plain_date_time(2026, 1, 31, 12, 30)
#> <zutempo_plain_date_time[1]>
#> [1] 2026-01-31T12:30:00
plain_date_time(plain_date("2026-01-31"))
#> <zutempo_plain_date_time[1]>
#> [1] 2026-01-31T00:00:00
plain_date_time_compare("2026-01-31T12:30", "2026-01-31T12:31")
#> [1] -1