Package org.vast.util

Class DateTimeFormat

java.lang.Object
org.vast.util.DateTimeFormat

public class DateTimeFormat extends Object

Formatter for Date and Time quantities. Contains helper routines to convert to and from ISO8601

Since:
Nov 29, 2005
  • Field Details

    • ISO_DATE_OR_TIME_FORMAT

      public static final DateTimeFormatter ISO_DATE_OR_TIME_FORMAT
  • Constructor Details

    • DateTimeFormat

      public DateTimeFormat()
  • Method Details

    • parseIsoPeriod

      public double parseIsoPeriod(String iso8601) throws ParseException
      Parses an ISO8601 period string and return the length of the period.
      Parameters:
      iso8601 -
      Returns:
      length of period in seconds
      Throws:
      ParseException
    • parseIso

      public double parseIso(String iso8601) throws ParseException
      Parses an ISO8601 data/time string and return the corresponding unix time
      Parameters:
      iso8601 -
      Returns:
      unix/julian time stamp
      Throws:
      ParseException
    • formatIsoPeriod

      public String formatIsoPeriod(double periodInSeconds)
      Formats a period expressed in seconds to ISO8601 time period standard
      Parameters:
      periodInSeconds -
      Returns:
      ISO string representing the period
    • formatIsoPeriod

      public String formatIsoPeriod(double periodInSeconds, char biggestUnit)
      Formats a period in seconds to ISO8601 period standard starting with the given unit and going down as much as required
      Parameters:
      periodInSeconds -
      biggestUnit - largest unit to use in encoded string (one of Y, M, D, H, m, S)
      Returns:
      ISO string representing the period
    • formatIso

      public String formatIso(double julianTime, int timeZone)
      Formats a julian time to ISO8601 standard
      Parameters:
      julianTime - Julian time with 1970 base
      timeZone - time zone to use in the ISO string
      Returns:
      ISO string representing the date/time