Class PeriodFormat


  • public class PeriodFormat
    extends Object
    Parser for scan or update periods
    Author:
    Kay Kasemir
    • Constructor Detail

      • PeriodFormat

        public PeriodFormat()
    • Method Detail

      • parseSeconds

        public static double parseSeconds​(String text)
        Parse seconds from text.

        Text must contain a (double) number, optionally followed by units "days", "hours", "minutes", "seconds". Only "m", "min", ... is interpreted as "minutes" as well. In the absense of units, it defaults to seconds.

        Parameters:
        text - Text to parse
        Returns:
        seconds
      • formatSeconds

        public static String formatSeconds​(double seconds)
        Format seconds as string, using hours or minutes if appropriate.
        Parameters:
        seconds - Seconds to format
        Returns:
        A string that parseSeconds() can handle.