Package: java.time

## [Java] Class LocalDateTime

- java.time.LocalDateTime

-     public class LocalDateTime
      extends Object

  GDK enhancements for LocalDateTime.

  displayName:
    LocalDateTime
  receiverFqcn:
    java.time.LocalDateTime

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public LocalDateTime` | `clearTime()` Returns a LocalDateTime with the time portion cleared.
    `` | `public String` | `format(String pattern)` Formats this date/time with the provided DateTimeFormatter pattern.
    `` | `public String` | `format(FormatStyle dateTimeStyle)` Formats this date/time in the provided, localized FormatStyle.
    `` | `public String` | `getDateString()` Formats this date/time with the DateTimeFormatter.ISO_LOCAL_DATE formatter.
    `` | `public String` | `getDateTimeString()` Formats this date/time with the DateTimeFormatter.ISO_LOCAL_DATE_TIME formatter.
    `` | `public String` | `getTimeString()` Formats this date/time with the DateTimeFormatter.ISO_LOCAL_TIME formatter.
    `` | `public OffsetDateTime` | `leftShift(ZoneOffset offset)` Returns an OffsetDateTime of this date/time and the provided ZoneOffset.
    `` | `public ZonedDateTime` | `leftShift(ZoneId zone)` Returns a OffsetDateTime of this date/time and the provided ZoneId.
    `` | `public LocalDateTime` | `minus(long seconds)` Returns a LocalDateTime that is `seconds` seconds before this date/time.
    `` | `public LocalDateTime` | `next()` Returns a LocalDateTime that is one second after this date/time.
    `` | `public static LocalDateTime` | `parse(LocalDateTime type, CharSequence text, String pattern)` Parse text into a LocalDateTime using the provided pattern.
    `` | `public LocalDateTime` | `plus(long seconds)` Returns a LocalDateTime that is `seconds` seconds after this date/time.
    `` | `public LocalDateTime` | `previous()` Returns a LocalDateTime that is one second before this date/time.
    `` | `public Calendar` | `toCalendar()` Returns a generally equivalent instance of Calendar.
    `` | `public Date` | `toDate()` Returns a generally equivalent instance of Date.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, clamp, clamp, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, takeIf, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### public LocalDateTime clearTime()

      Returns a LocalDateTime with the time portion cleared.

      Returns:
        a LocalDateTime
      Since:
        2.5.0

    - #### public String format(String pattern)

      Formats this date/time with the provided DateTimeFormatter pattern.

      Parameters:
        `pattern` - the formatting pattern
      Returns:
        a formatted String
      See Also:
        DateTimeFormatter
      Since:
        2.5.0

    - #### public String format(FormatStyle dateTimeStyle)

      Formats this date/time in the provided, localized FormatStyle.

      Parameters:
        `dateTimeStyle` - the FormatStyle
      Returns:
        a formatted String
      See Also:
        DateTimeFormatter
      Since:
        2.5.0

    - #### public String getDateString()

      Formats this date/time with the DateTimeFormatter.ISO_LOCAL_DATE formatter.

      Returns:
        a formatted String
      See Also:
        DateTimeFormatter
      Since:
        2.5.0

    - #### public String getDateTimeString()

      Formats this date/time with the DateTimeFormatter.ISO_LOCAL_DATE_TIME formatter.

      Returns:
        a formatted String
      See Also:
        DateTimeFormatter
      Since:
        2.5.0

    - #### public String getTimeString()

      Formats this date/time with the DateTimeFormatter.ISO_LOCAL_TIME formatter.

      Returns:
        a formatted String
      See Also:
        DateTimeFormatter
      Since:
        2.5.0

    - #### public OffsetDateTime leftShift(ZoneOffset offset)

      Returns an OffsetDateTime of this date/time and the provided ZoneOffset.

      Parameters:
        `offset` - a ZoneOffset
      Returns:
        an OffsetDateTime
      Since:
        2.5.0

    - #### public ZonedDateTime leftShift(ZoneId zone)

      Returns a OffsetDateTime of this date/time and the provided ZoneId.

      Parameters:
        `zone` - a ZoneId
      Returns:
        a ZonedDateTime
      Since:
        2.5.0

    - #### public LocalDateTime minus(long seconds)

      Returns a LocalDateTime that is `seconds` seconds before this date/time.

      Parameters:
        `seconds` - the number of seconds to subtract
      Returns:
        a LocalDateTime
      Since:
        2.5.0

    - #### public LocalDateTime next()

      Returns a LocalDateTime that is one second after this date/time.

      Returns:
        a LocalDateTime
      Since:
        2.5.0

    - #### public static LocalDateTime parse(LocalDateTime type, CharSequence text, String pattern)

      Parse text into a LocalDateTime using the provided pattern. Note: the order of parameters differs from versions of this method for the legacy Date class.

      throws:
        java.lang.IllegalArgumentException if the pattern is invalid
      throws:
        java.time.format.DateTimeParseException if the text cannot be parsed
      Parameters:
        `type` - placeholder variable used by Groovy categories; ignored for default static methods
        `text` - String to be parsed to create the date instance
        `pattern` - pattern used to parse the text
      Returns:
        a LocalDateTime representing the parsed text
      See Also:
        DateTimeFormatter
        LocalDateTime.parse
      Since:
        2.5.0

    - #### public LocalDateTime plus(long seconds)

      Returns a LocalDateTime that is `seconds` seconds after this date/time.

      Parameters:
        `seconds` - the number of seconds to add
      Returns:
        a LocalDateTime
      Since:
        2.5.0

    - #### public LocalDateTime previous()

      Returns a LocalDateTime that is one second before this date/time.

      Returns:
        a LocalDateTime
      Since:
        2.5.0

    - #### public Calendar toCalendar()

      Returns a generally equivalent instance of Calendar. The time value of the returned calendar is truncated to milliseconds and the time zone is the current system default.

      Returns:
        a java.util.Calendar
      Since:
        2.5.0

    - #### public Date toDate()

      Returns a generally equivalent instance of Date. The time value of the returned date is truncated to milliseconds.

      Returns:
        a java.util.Date
      Since:
        2.5.0