Class LocalDateFactory

java.lang.Object
com.atlassian.jira.datetime.LocalDateFactory

public class LocalDateFactory extends Object
Used for creating LocalDate objects.
Since:
v4.4
  • Constructor Details

    • LocalDateFactory

      public LocalDateFactory()
  • Method Details

    • from

      public static LocalDate from(Date date)
      Constructs a new LocalDate from the given java.util.Date by interpreting the Date in the system (JVM) timezone.

      NB will return null output for null input

      Parameters:
      date - the date to convert
      Returns:
      a new LocalDate from the given java.util.Date by interpreting the Date in the system (JVM) timezone. (null output for null input)
    • getLocalDate

      public static LocalDate getLocalDate(Date date, TimeZone timeZone)
      Returns the LocalDate for a point in time in a given TimeZone.

      NB will return null output for null input

      Parameters:
      date - The point in time
      timeZone - The TimeZone
      Returns:
      the LocalDate for a point in time in a given TimeZone
    • fromMillisSinceEpoch

      public static LocalDate fromMillisSinceEpoch(long millisecondsSinceEpoch)
      Creates a local date based on the number of milliseconds since epoch using a zero offset.
      Parameters:
      millisecondsSinceEpoch - Can be negative
      Returns:
      The matching local date
      Since:
      11.0
    • fromIsoBasicFormat

      public static LocalDate fromIsoBasicFormat(String isoDate)
      Turns an "ISO Basic" formatted date (ie YYYYMMDD) into a LocalDate.
      Parameters:
      isoDate - an "ISO Basic" formatted date
      Returns:
      the LocalDate represented by the given ISO format String
    • toIsoBasic

      public static String toIsoBasic(LocalDate localDate)
      Formats the given LocalDate in "ISO Basic" format (ie YYYYMMDD).
      Parameters:
      localDate - the date to format.
      Returns:
      the "ISO Basic" format (or null for null input)