Class UtcTimeUtilities


  • public class UtcTimeUtilities
    extends Object
    An utility class for time related issues, all in UTC timezone.

    This class is supposed to handle only the string format YYYY-MM-DD HH:MM:SS. If not explicitly defined, that format, with or without seconds, is used.

    Since:
    0.7.0
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • UtcTimeUtilities

        public UtcTimeUtilities()
    • Method Detail

      • newDateTime

        public static org.joda.time.DateTime newDateTime()
        Getter for the current time.
        Returns:
        the current time in utc.
      • fromStringWithSeconds

        public static org.joda.time.DateTime fromStringWithSeconds​(String dateTimeString)
        Get DateTime from date string of format: YYYY-MM-DD HH:MM:SS.
        Parameters:
        dateTimeString - the date string.
        Returns:
        the parsed datetime.
      • fromStringWithMinutes

        public static org.joda.time.DateTime fromStringWithMinutes​(String dateTimeString)
        Get DateTime from date string of format: YYYY-MM-DD HH:MM.
        Parameters:
        dateTimeString - the date string.
        Returns:
        the parsed datetime.
      • toStringWithSeconds

        public static String toStringWithSeconds​(org.joda.time.DateTime dateTime)
        Get String of format: YYYY-MM-DD HH:MM:SS from DateTime.
        Parameters:
        dateTime - the DateTime.
        Returns:
        the date string.
      • toStringWithMinutes

        public static String toStringWithMinutes​(org.joda.time.DateTime dateTime)
        Get String of format: YYYY-MM-DD HH:MM from DateTime.
        Parameters:
        dateTime - the DateTime.
        Returns:
        the date string.
      • quickToString

        public static String quickToString​(long unixEpoch)
        Quick long to timestamp string formatter, UTC.
        Parameters:
        unixEpoch - the unix epoch to convert.
        Returns:
        the timestamp string as yyyy-MM-dd HH:mm:ss
      • quickToStringLocal

        public static String quickToStringLocal​(long unixEpoch)
        Quick long to timestamp string formatter.
        Parameters:
        unixEpoch - the unix epoch to convert.
        Returns:
        the timestamp string as yyyy-MM-dd HH:mm:ss