CurrentTime: Difference between revisions

From Compost Wiki
Jump to navigation Jump to search
FabienT (talk | contribs)
No edit summary
FabienT (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
{{Description|description=This command outputs the current time of day in the specified format. It is an extension of [[Time$]], which always formats the time according to the UI culture.
{{Description|description=This command outputs the current time of day in the specified format. It is an extension of [[Time$]], which always formats the time according to the UI culture.


Acceptable Time Formats are:
Acceptable 'Time Formats' are:
*<b>STANDARD_12</b> (or STD_12) - 12-hour clock with an AM/PM suffix, such as: "3:05 PM"
*<b>STANDARD_12</b> (or <b>STD_12</b>) - 12-hour clock with an AM/PM suffix, such as: "3:05 PM"
*CIVILIAN_24 (or CIV_24) - 24-hour clock with a colon separator, such as: "15:05"
*<b>CIVILIAN_24</b> (or <b>CIV_24</b>) - 24-hour clock with a colon separator, such as: "15:05"
*MILITARY (or MIL) - 24-hour clock with no separator, followed by "hours", such as: "1505 hours"
*<b>MILITARY</b> (or <b>MIL</b>) - 24-hour clock with no separator, followed by "hours", such as: "1505 hours"
*MILITARY_SHORT (or MIL_SHORT) - 24-hour clock with no separator, such as: "1505"
*<b>MILITARY_SHORT</b> (or <b>MIL_SHORT</b>) - 24-hour clock with no separator, such as: "1505"
*DEFAULT, DEFAULT_CULTURE, CURRENT, CURRENT_CULTURE, or an empty string - formats the time according to the UI culture (i.e. the language used during installation), exactly as [[Time$]] does. For US English installs this returns an AM/PM string such as: "3:05 PM"
*<b>DEFAULT</b>, <b>DEFAULT_CULTURE</b>, <b>CURRENT</b>, <b>CURRENT_CULTURE</b>, or an <b>empty string</b> - formats the time according to the UI culture (i.e. the language used during installation), exactly as [[Time$]] does. For US English installs this returns an AM/PM string such as: "3:05 PM"


The Time Format argument is mandatory, but it is not case sensitive. An unrecognized format will stop the post with an error, so a misspelled descriptor is reported rather than silently ignored.
The Time Format argument is mandatory, but it is not case sensitive. An unrecognized format will stop the post with an error, so a misspelled descriptor is reported rather than silently ignored.
Line 24: Line 24:


==See Also==
==See Also==
[[Time$]]
[[Time$]], [[Date$]], [[TimeComment?]]
[[Date$]]
[[TimeComment]]
[[Category:Comments]]
[[Category:Comments]]

Latest revision as of 02:46, 18 September 2026

CurrentTime$('Time Format')

Description

This command outputs the current time of day in the specified format. It is an extension of Time$, which always formats the time according to the UI culture.

Acceptable 'Time Formats' are:

  • STANDARD_12 (or STD_12) - 12-hour clock with an AM/PM suffix, such as: "3:05 PM"
  • CIVILIAN_24 (or CIV_24) - 24-hour clock with a colon separator, such as: "15:05"
  • MILITARY (or MIL) - 24-hour clock with no separator, followed by "hours", such as: "1505 hours"
  • MILITARY_SHORT (or MIL_SHORT) - 24-hour clock with no separator, such as: "1505"
  • DEFAULT, DEFAULT_CULTURE, CURRENT, CURRENT_CULTURE, or an empty string - formats the time according to the UI culture (i.e. the language used during installation), exactly as Time$ does. For US English installs this returns an AM/PM string such as: "3:05 PM"

The Time Format argument is mandatory, but it is not case sensitive. An unrecognized format will stop the post with an error, so a misspelled descriptor is reported rather than silently ignored.


Stats

ID 66
Type String
Class All Machines
Min Version 26.1.19


Notes

  • Only hours and minutes are output; there is no seconds output in any format.
  • The 12-hour format does not zero pad the hour, so times before 10 AM output as: "9:05 AM". The three 24-hour formats always zero pad both the hour and the minutes.
  • Midnight and noon follow the usual 12-hour convention: 00:05 outputs as "12:05 AM", and 12:05 outputs as "12:05 PM".
  • When posting in silent mode, or when the post is run from a script, this command outputs nothing at all and the requested Time Format is ignored. Time$ and Date$ behave the same way. Posts should therefore not assume that a time will always be present in the output, and should not rely on its presence for line numbering, block counts or fixed-width formatting.

See Also

Time$, Date$, TimeComment?