Class DateTimeSupport

java.lang.Object
org.opencastproject.util.DateTimeSupport

public final class DateTimeSupport extends Object
Utility class used to convert from and to UTC time.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    JAXB adapter that formats dates in UTC format YYYY-MM-DD'T'hh:mm:ss'Z' up to second, e.g. 1970-01-01T00:00:00Z
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    This methods reads a utc date string and returns it's unix time equivalent in milliseconds.
    static String
    humanReadableTime(long seconds)
    Converts seconds to a human readable time string.
    static String
    toUTC(long time)
    Returns the date and time in milliseconds as a utc formatted string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fromUTC

      public static long fromUTC(String s) throws IllegalStateException, ParseException
      This methods reads a utc date string and returns it's unix time equivalent in milliseconds. i.e. yyyy-MM-ddTHH:mm:ssZ e.g. 2014-09-27T16:25Z
      Parameters:
      s - the utc string
      Returns:
      the date/time in milliseconds
      Throws:
      IllegalStateException
      ParseException - if the date string is malformed
    • toUTC

      public static String toUTC(long time)
      Returns the date and time in milliseconds as a utc formatted string.
      Parameters:
      time - the utc time string
      Returns:
      the local time
    • humanReadableTime

      public static String humanReadableTime(long seconds)
      Converts seconds to a human readable time string.