Class TimeFormat

java.lang.Object
com.tccc.kos.commons.util.format.time.TimeFormat
Direct Known Subclasses:
T_HHmm, T_hhmma

public class TimeFormat extends Object
Describes a time format for both Java and JavaScript. This includes a hint about whether the format is a 12- or 24-hour format, which allows editors to generate the correct options for the format.

Time formatting characters are:

  H = hour-of-day (0-23)
  h = clock-hour-of-am-pm (1-12)
  m = minute-of-hour
  a = am-pm-of-day
 
Since:
1.0
Version:
2023-02-24
See Also:
  • Constructor Details

    • TimeFormat

      public TimeFormat(String id, String format, boolean ampm)
      Creates a new time format with the specified properties.
      Parameters:
      id - the ID of the format
      format - format string
      ampm - true for 12-hour clock formats
  • Method Details

    • getId

      public String getId()
      Returns the ID of the format. This is used to identify and select the format. This should not be a display value. A localization key should be used to convert this to a display string.
    • getFormat

      public String getFormat()
      Returns the format string for this time format.
    • getAmpm

      public boolean getAmpm()
      Returns true for 12-hour clock, false for 24-hour clock.