Java™ Platform
Standard Ed. 8

Uses of Class
java.time.Clock

  • Packages that use Clock 
    Package Description
    java.time
    The main API for dates, times, instants, and durations.
    java.time.chrono
    Generic API for calendar systems other than the default ISO.
    • Uses of Clock in java.time

      Methods in java.time that return Clock 
      Modifier and Type Method and Description
      static Clock Clock.fixed(Instant fixedInstant, ZoneId zone)
      Obtains a clock that always returns the same instant.
      static Clock Clock.offset(Clock baseClock, Duration offsetDuration)
      Obtains a clock that returns instants from the specified clock with the specified duration added
      static Clock Clock.system(ZoneId zone)
      Obtains a clock that returns the current instant using best available system clock.
      static Clock Clock.systemDefaultZone()
      Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the default time-zone.
      static Clock Clock.systemUTC()
      Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone.
      static Clock Clock.tick(Clock baseClock, Duration tickDuration)
      Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.
      static Clock Clock.tickMinutes(ZoneId zone)
      Obtains a clock that returns the current instant ticking in whole minutes using best available system clock.
      static Clock Clock.tickSeconds(ZoneId zone)
      Obtains a clock that returns the current instant ticking in whole seconds using best available system clock.
      abstract Clock Clock.withZone(ZoneId zone)
      Returns a copy of this clock with a different time-zone.
      Methods in java.time with parameters of type Clock 
      Modifier and Type Method and Description
      static Year Year.now(Clock clock)
      Obtains the current year from the specified clock.
      static MonthDay MonthDay.now(Clock clock)
      Obtains the current month-day from the specified clock.
      static YearMonth YearMonth.now(Clock clock)
      Obtains the current year-month from the specified clock.
      static OffsetTime OffsetTime.now(Clock clock)
      Obtains the current time from the specified clock.
      static LocalDateTime LocalDateTime.now(Clock clock)
      Obtains the current date-time from the specified clock.
      static LocalDate LocalDate.now(Clock clock)
      Obtains the current date from the specified clock.
      static ZonedDateTime ZonedDateTime.now(Clock clock)
      Obtains the current date-time from the specified clock.
      static OffsetDateTime OffsetDateTime.now(Clock clock)
      Obtains the current date-time from the specified clock.
      static Instant Instant.now(Clock clock)
      Obtains the current instant from the specified clock.
      static LocalTime LocalTime.now(Clock clock)
      Obtains the current time from the specified clock.
      static Clock Clock.offset(Clock baseClock, Duration offsetDuration)
      Obtains a clock that returns instants from the specified clock with the specified duration added
      static Clock Clock.tick(Clock baseClock, Duration tickDuration)
      Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.
    • Uses of Clock in java.time.chrono

      Methods in java.time.chrono with parameters of type Clock 
      Modifier and Type Method and Description
      ThaiBuddhistDate ThaiBuddhistChronology.dateNow(Clock clock) 
      JapaneseDate JapaneseChronology.dateNow(Clock clock) 
      HijrahDate HijrahChronology.dateNow(Clock clock) 
      MinguoDate MinguoChronology.dateNow(Clock clock) 
      LocalDate IsoChronology.dateNow(Clock clock)
      Obtains the current ISO local date from the specified clock.
      default ChronoLocalDate Chronology.dateNow(Clock clock)
      Obtains the current local date in this chronology from the specified clock.
      static ThaiBuddhistDate ThaiBuddhistDate.now(Clock clock)
      Obtains the current ThaiBuddhistDate from the specified clock.
      static JapaneseDate JapaneseDate.now(Clock clock)
      Obtains the current JapaneseDate from the specified clock.
      static HijrahDate HijrahDate.now(Clock clock)
      Obtains the current HijrahDate of the Islamic Umm Al-Qura calendar from the specified clock.
      static MinguoDate MinguoDate.now(Clock clock)
      Obtains the current MinguoDate from the specified clock.
Java™ Platform
Standard Ed. 8

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部