Skip to content
FutureBlitz

    Install

    Import std.time.calendar

    LocalDateTime

    std.time.calendar

    struct

    Public Struct LocalDateTime Implements Comparable, Hashable, Printable, Defaultable

    A date and a time of day, without a zone, as a wall calendar and clock show them.

    Examples

    Local meeting = LocalDateTime(2024, 3, 9, 14, 30)
    Expect("{meeting}" == "2024-03-09T14:30:00")
    Expect(meeting.AddDays(1).Date == Date(2024, 3, 10))
    Expect(LocalDateTime.Parse("2024-03-09T14:30:00") == meeting)

    std/time/calendar.fb, line 407

    • Public New(date: Date, time: TimeOfDay) constructor #

      The time of day time on date.

    • @PanicsAtCaller Public New(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, nanosecond: Int = 0) constructor #

      The date and time, which panics when either isn't one.

    • Public Static Method DefaultValue(): LocalDateTime static method #

      Midnight on 1970-01-01.

    • Public Static Method MinValue(): LocalDateTime static method #

      The earliest LocalDateTime there is.

    • Public Static Method MaxValue(): LocalDateTime static method #

      The latest LocalDateTime there is.

    • Public Static Method Now(zone: TimeZone): LocalDateTime static method #

      Now, where the zone is, or the OS's zone.

    • Public Static Method Now(): LocalDateTime static method #

      Now, in the OS's zone.

    • Public Static Method Parse(text: String): LocalDateTime? static method #

      The date and time ISO 8601 writes, like "2026-10-23T12:30:00", with "T", "t", or a space between them, or Null.

    • @PanicsAtCaller Public Static Method Parse(text: String, pattern: String): LocalDateTime? static method #

      The date and time the text writes as the pattern says (see format.fb), or Null. A pattern without the year, or without the month and day or the day of the year, panics; the time's parts it doesn't have are 0.

    • Public Property Date: Date property #

      Its date.

    • Public Property Time: TimeOfDay property #

      Its time of day.

    • Public Property Year: Int property #

      Its date's year.

    • Public Property Month: Int property #

      Its date's month, from 1 to 12.

    • Public Property DayOfMonth: Int property #

      Its date's day of the month, from 1.

    • Public Property Hour: Int property #

      Its hour, from 0 to 23.

    • Public Property Minute: Int property #

      Its minute, from 0 to 59.

    • Public Property Second: Int property #

      Its second, from 0 to 59.

    • Public Property Nanosecond: Int property #

      Its nanosecond of the second.

    • Public Property DayOfWeek: Weekday property #

      Its date's day of the week.

    • Public Property DayOfYear: Int property #

      Its date's day of the year, from 1.

    • @PanicsAtCaller Public Method AddDays(count: Int64): LocalDateTime method #

      The same time count days after, or before, as Date's AddDays goes.

    • @PanicsAtCaller Public Method AddMonths(count: Int64): LocalDateTime method #

      The same time count months after, or before, as Date's AddMonths goes.

    • @PanicsAtCaller Public Method AddYears(count: Int64): LocalDateTime method #

      The same time count years after, or before, as Date's AddYears goes.

    • Public Method StartOfDay(): LocalDateTime method #

      Midnight on its day.

    • @PanicsAtCaller Public Method InZone(zone: TimeZone, disambiguation: Disambiguation = Disambiguation.COMPATIBLE): ZonedDateTime method #

      It where the zone is. When the zone's clocks show it twice, as they're turned back, or never, as they skip it, the disambiguation says which moment it is (see zone.fb).

    • @PanicsAtCaller Operator +(a: LocalDateTime, b: Duration): LocalDateTime operator #

      b after a, on a clock that's never turned: 23:00 plus 2 hours is 01:00 the next day.

    • @PanicsAtCaller Operator -(a: LocalDateTime, b: Duration): LocalDateTime operator #

      b before a, on a clock that's never turned: 01:00 minus 2 hours is 23:00 the day before.

    • @PanicsAtCaller Operator -(a: LocalDateTime, b: LocalDateTime): Duration operator #

      How long it is from b to a, on a clock that's never turned, which panics past the longest Duration.

    • Operator <(a: LocalDateTime, b: LocalDateTime): Bool operator #

      Whether a is before b.

    • Public Method ToString(): String method #

      As ISO 8601 writes it, like "2026-10-23T12:30:00".

    • @PanicsAtCaller Public Method Format(pattern: String): String method #

      As the pattern says (see format.fb): Format("yyyy-MM-dd HH:mm") is "2026-10-23 12:30". A pattern letter of a zone panics.

    Report an issue with this page or with FutureBlitz on GitHub.