CurrentTime: Difference between revisions

From Compost Wiki
Jump to navigation Jump to search
FabienT (talk | contribs)
Created page with "==CurrentTime$('Time Format')== {{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: *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, follow..."
 
FabienT (talk | contribs)
No edit summary
Line 4: Line 4:


Acceptable Time Formats are:
Acceptable Time Formats are:
*STANDARD_12 (or STD_12) - 12-hour clock with an AM/PM suffix, such as: "3:05 PM"
*<b>STANDARD_12</b> (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"
*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 (or MIL) - 24-hour clock with no separator, followed by "hours", such as: "1505 hours"
Line 12: Line 12:
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.
}}
}}
{{Stats|id=66|type=String|class=All Machines|scope=|version=11.8.x}}
{{Stats|id=66|type=String|class=All Machines|scope=|version=26.1.19}}


===Notes===
===Notes===
Only hours and minutes are output; there is no seconds output in any format.
*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.
*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".
*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.
*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==
==See Also==

Revision as of 02:34, 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