20230630 java.time.LocalDateTime

介绍

  • java.time.LocalDateTime
  • 类声明
  • 本地日期时间
@jdk.internal.ValueBased public final class LocalDateTime implements Temporal, TemporalAdjuster, ChronoLocalDateTime<LocalDate>, Serializable
  • 实现 Temporal ,支持的时间单位( TemporalUnit )有

    • NANOS
    • MICROS
    • MILLIS
    • SECONDS
    • MINUTES
    • HOURS
    • HALF_DAYS
    • DAYS
    • WEEKS
    • MONTHS
    • YEARS
    • DECADES
    • CENTURIES
    • MILLENNIA
    • ERAS
  • 实现 TemporalAccessor ,支持的时间域( TemporalField )有

    • NANO_OF_SECOND
    • NANO_OF_DAY
    • MICRO_OF_SECOND
    • MICRO_OF_DAY
    • MILLI_OF_SECOND
    • MILLI_OF_DAY
    • SECOND_OF_MINUTE
    • SECOND_OF_DAY
    • MINUTE_OF_HOUR
    • MINUTE_OF_DAY
    • HOUR_OF_AMPM
    • CLOCK_HOUR_OF_AMPM
    • HOUR_OF_DAY
    • CLOCK_HOUR_OF_DAY
    • AMPM_OF_DAY
    • DAY_OF_WEEK
    • ALIGNED_DAY_OF_WEEK_IN_MONTH
    • ALIGNED_DAY_OF_WEEK_IN_YEAR
    • DAY_OF_MONTH
    • DAY_OF_YEAR
    • EPOCH_DAY
    • ALIGNED_WEEK_OF_MONTH
    • ALIGNED_WEEK_OF_YEAR
    • MONTH_OF_YEAR
    • PROLEPTIC_MONTH
    • YEAR_OF_ERA
    • YEAR
    • ERA
  • 内部存储是

private final LocalDate date;
private final LocalTime time;

API

常量

  • MIN : -999999999-01-01T00:00
  • MAX : +999999999-12-31T23:59:59.999999999

static

  • now
  • of
  • ofInstant
  • ofEpochSecond
  • from
  • parse
    • toString
    • 格式:2007-12-03T10:15:30

public

  • truncatedTo
  • toString

get

  • getYear
  • getMonthValue
  • getMonth
  • getDayOfMonth
  • getDayOfYear
  • getDayOfWeek
  • getHour
  • getMinute
  • getSecond
  • getNano

with

  • withYear
  • withMonth
  • withDayOfMonth
  • withDayOfYear
  • withHour
  • withMinute
  • withSecond
  • withNano

plus/minus

  • plusYears
  • plusMonths
  • plusWeeks
  • plusDays
  • plusHours
  • plusMinutes
  • plusSeconds
  • plusNanos
  • minusYears
  • minusMonths
  • minusWeeks
  • minusDays
  • minusHours
  • minusMinutes
  • minusSeconds
  • minusNanos

at

  • atOffset
posted @ 2023-09-05 09:25  流星<。)#)))≦  阅读(6)  评论(0编辑  收藏  举报