Class DateAndTime

java.lang.Object
eu.bandm.tools.util.ui.DateAndTime

public class DateAndTime extends Object
Utility class for date and time procesing end representation.
  • Field Details

    • FORMAT_DATE_AND_TIME

      public static final String FORMAT_DATE_AND_TIME
      String formatting template for date and time. This string passed as the format control to String.format(String,Object...) with some GregorianCalendar as second argument. Date and Time format is set to the same format as the shell function "makedate" in "etc/calltools.mk", (beside that the latter does currently not include seconds.)
      The result looks like
      2009-07-21_01h09m07s

      The day-part is defined by the Java string formatting standard code "%tF", which directly corresponds to "%tY-%tm-%td", and thus verbatim to ISO 8601
      The time-of-day part closely follows the "extended format" of ISO 8601 cf. ISO 8601/en and ISO 8601/de
      But the separation character "." is replaced by "h" and "m", to make the string directoy usable as a file name/time stamp. (windoof does not allow colon in file names, and you shouldn't try with unix.)

      Alternatives would have been ...

      1. better readable "%tF %tHh%tMm%tS"
      2. older version "%tF %tT"
      3. completely consistent with "extended" format from ISO8601 is "%tFT%tT"
      But the latter two both work like "%tH:%tM:%tS", thus inserting ":" colon chars. So these again could not be used as (compontens of) file names.
      See Also:
  • Method Details

    • dateNow_standardFormat

      public static String dateNow_standardFormat()
      Returns the current state of the calendaric clock in the format defined by FORMAT_DATE_AND_TIME.
      Returns:
      a string with the current date and time
    • date_standardFormat

      public static String date_standardFormat(GregorianCalendar now)
      Returns the given date in the format defined by FORMAT_DATE_AND_TIME.
      Parameters:
      now - the date and time to render
      Returns:
      a string with the given date and time