TSTool / Command / FormatDateTimeProperty
Overview
The FormatDateTimeProperty command creates a new processor property by
formatting an existing date/time property.
These properties are accessible to commands using ${Property} notation.
A formatted date/time string is useful when specifying filenames more dynamically.
Date/time properties will by default be formatted using the ISO 8061 format (e.g., YYYY-MM-DD hh:mm:ss).
Support for properties varies by command and command documentation should be consulted.
Command Editor
The command is available in the following TSTool menu:
- Commands / General - Running and Properties
The following dialog is used to edit the command and illustrates the command syntax.
FormatDateTimeProperty Command Editor (see full-size image)
Command Syntax
The command syntax is as follows:
FormatDateTimeProperty(Parameter="Value",...)
Command Parameters
| Parameter | Description | Default |
|---|---|---|
PropertyName |
The name of the string property to be created. | None – must be specified. |
DateTimePropertyName |
The name of the existing date/time property to be formatted. | None – must be specified. |
FormatterType |
The date/time formatter type, which defines the format specifiers, one of:
|
C |
Format |
The format string for the formatter, which defines how date/time data parts are formatted into the new string property. The string is interpreted by the formatter as follows:
|
None – must be specified. |
PropertyType |
Indicate the output property type, which allows the command to create properties other than strings. The formatted string must have an appropriate value to allow the conversion:
String |
The following table lists the supported formatting strings for FormatterType=C:
Supported C (strftime) Formatting Specifiers
| Format Specifier | Description |
|---|---|
%a |
Weekday abbreviation (e.g., Sun) |
%A |
Weekday (e.g., Sunday). |
%b |
Month abbreviation (e.g., Jan). |
%B |
Month (e.g., January). |
%d |
Day (01-31). |
%H |
Hour (00-23). |
%I |
Hour (01-12). |
%j |
Day of year (001-366). |
%m |
Month (01-12). |
%M |
Minute (00-59). |
%p |
AM, PM (noon=PM, midnight=AM). |
%S |
Second (00-59). |
%y |
Year (00-99). |
%Y |
Year (0000-9999). |
%Z |
Time zone (e.g., MST). |
Examples
See the automated tests.
A sample command file is as follows:
SetProperty(PropertyName="DateTimeProp",PropertyType=DateTime,PropertyValue="CurrentToSecond")
FormatDateTimeProperty(PropertyName="DateTimePropString",DateTimePropertyName="DateTimeProp",Format="%Y-%m-%dT%H:%M:%S")
Troubleshooting
See the main TSTool Troubleshooting documentation.
See Also
FormatStringPropertycommandSetPropertycommand