Interface TimeProvider

All Known Implementing Classes:
DefaultTimeProvider

public interface TimeProvider
A TimeProvider is able to provide dates and times.
Author:
Heiko Scherrer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The format pattern for all date-time with milliseconds and timezone types.
    static final String
    The format pattern for all date-time with timezone types.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Instant
    now()
    Returns the current date and time of the system considering the configured timezone.
    default Date
    Returns the current date and time considering the configured timezone.
    Returns the current date and time considering the configured timezone.
    Returns the current date and time considering the configured timezone.
  • Field Details

    • DATE_TIME_MILLIS_WITH_TIMEZONE

      static final String DATE_TIME_MILLIS_WITH_TIMEZONE
      The format pattern for all date-time with milliseconds and timezone types.
      See Also:
    • DATE_TIME_WITH_TIMEZONE

      static final String DATE_TIME_WITH_TIMEZONE
      The format pattern for all date-time with timezone types.
      See Also:
  • Method Details

    • nowAsDate

      default Date nowAsDate()
      Returns the current date and time considering the configured timezone.
      Returns:
      Timezone aware Date
    • nowAsZonedDateTime

      default ZonedDateTime nowAsZonedDateTime()
      Returns the current date and time considering the configured timezone.
      Returns:
      Timezone aware DateTime
    • nowAsZonedDateTime

      default ZonedDateTime nowAsZonedDateTime(ZoneId zoneId)
      Returns the current date and time considering the configured timezone.
      Parameters:
      zoneId - ZoneId
      Returns:
      Timezone aware DateTime
    • now

      default Instant now()
      Returns the current date and time of the system considering the configured timezone.
      Returns:
      Timezone aware Date