Custom DateTime codes

From VoxCommando
Jump to: navigation, search

Using {DtCustom.????} we can retrieve the current date and time the way we want rather than being limited to the pre-formatted {ShortTime}/{LongDate}/etc. variables.

Replace the question marks with one of the following codes (follow link below for more codes).

MMM Three-letter month
dddd The full name of the day of the week
ddd The abbreviated name of the day of the week
dd The day of the month, from 01 through 31
d Day of the month, from 1 through 31
HH Two-digit hours on 24-hour scale
mm Two-digit minutes
yyyy Four-digit year

Examples

To get the day of the month: {DtCustom.%d} or {DtCustom.dd}. The first will retain single digit days as single digits, the second will display them as 01 through 09.

If you want to concatenate two d/t strings together, you don't need to insert a % placeholder to display single digit values.

Example: If it's 9 AM, {DtCustom.%H} is interpreted as 9. {DtCustom.Hmm} becomes 900, {DtCustom.HHmm} becomes 0900.


A complete list of date/time variables can be found at the following reference: http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.90).aspx

The Microsoft variable table is extremely clear, and well worth consulting. Important note from this page:

To use any of the custom date and time format specifiers as the only specifier in a format string (that is, to use the "d", "f", "F", "g", "h", "H", "K", "m", "M", "s", "t", "y", "z", ":", or "/" custom format specifier by itself), include a space before or after the specifier, or include a percent ("%") format specifier before the single custom date and time specifier.
For example, "%h" is interpreted as a custom date and time format string that displays the hour represented by the current date and time value. You can also use the " h" or "h " format string, although this includes a space in the result string along with the hour.

In order to use % you must have VoxCommando version 1.1.87 or later. As an alternative you can use a space, so for example {DtCustom. H} but note that your result will also contain a space.