Class TimeUtil


  • public final class TimeUtil
    extends Object
    A util class that exists to simply get date and time values like the year or the current timestamp.
    • Method Detail

      • getLongTimeStamp

        public static String getLongTimeStamp()
        Gets the current timestamp in 24h format with date and double digits for both hour and minute, separated by a colon.
        Returns:
        The timestamp formatted like: "yyyy/MM/dd HH:mm:ss"
        See Also:
        SimpleDateFormat
      • getTimeStamp

        public static String getTimeStamp()
        Gets the current timestamp in 24h format and double digits for both hour and minute, separated by a colon.
        Returns:
        The timestamp formatted like: "HH:mm:ss"
        See Also:
        SimpleDateFormat
      • getShortTimeStamp

        public static String getShortTimeStamp()
        Gets the current timestamp in 24h format without seconds and double digits for both hour and minute, separated by a colon.
        Returns:
        The timestamp formatted like: "HH:mm"
        See Also:
        SimpleDateFormat
      • getDate

        public static String getDate()
        Gets the date in the month formatted to always have two digits. And the year with four.
        Returns:
        The date formatted like: "yyyy/MM/dd"
        See Also:
        SimpleDateFormat
      • getDay

        public static String getDay()
        Gets the day in the month formatted to always have two digits.
        Returns:
        The date formatted like: "dd"
        See Also:
        SimpleDateFormat
      • getMonth

        public static String getMonth()
        Gets the month in the year formatted to always have two digits.
        Returns:
        The date formatted like: "MM"
        See Also:
        SimpleDateFormat
      • getYear

        public static String getYear()
        Gets the the year formatted to always have four digits.
        Returns:
        The date formatted like: "yyyy"
        See Also:
        SimpleDateFormat
      • convertStringTimeToDouble

        public static double convertStringTimeToDouble​(String stringedTime)
        Gets the time value as a double from a String.
        Parameters:
        stringedTime - The time as string to convert
        Returns:
        double The time as double in milliseconds