FormatTime

From MultiCharts
Jump to navigation Jump to search

Returns a formated string expression corresponding to the time (fractional) portion of the specified DateTime value.

The format of the string expression, including separators, is defined by the specified format string. The format string consists of one or more elements arranged in the desired order. Each element represents a particular unit of time in a specific format. Spaces and separator characters to be used can be inserted within the format string.

Usage

FormatTime("FormatString", DateTime)

Parameters

FormatString - a format string, specifying the format of the output string expression representing the time.
The following elements can be used in the format string:
h Hours in 12-hour AM/PM format with no leading zero for single-digit hours.
hh Hours in 12-hour AM/PM format with leading zero for single-digit hours.
H Hours in 24-hour format with no leading zero for single-digit hours.
HH Hours in 24-hour format with leading zero for single-digit hours.
m Minutes with no leading zero for single-digit minutes.
mm Minutes with leading zero for single-digit minutes.
s Seconds with no leading zero for single-digit seconds.
ss Seconds with leading zero for single-digit seconds.
t One character AM/PM designator.
tt Multicharacter AM/PM designator.
DateTime - a double-precision decimal DateTime value to be converted to a string expression representing the time. The integer portion of the DateTime value specifies the number of days since January 1st, 1900, and the fractional portion of the DateTime value specifies the fraction of the day since midnight.

Example

FormatTime("hh:mm:ss t",39469.6674) will return the string "04:01:03 P" 

FormatTime("h tt",39469.6674) will return the string "4 PM" 

FormatTime("HH:mm",39469.6674) will return the string "16:01" 

FormatTime("m MIN s SEC",39469.6674) will return the string "1 MIN 3 SEC"