FormatDate

From MultiCharts
Jump to: navigation, search

Returns a formatted string expression corresponding to the date (integer) portion of the specified DateTime value.

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

Usage

FormatDate("FormatString", DateTime)

Parameters

FormatString - a format string, specifying the format of the output string expression representing the date.
The following elements can be used in the format string:
d Day of month as digits with no leading zero for single-digit days.
dd Day of month as digits with leading zero for single-digit days.
ddd Day of week as a three-letter abbreviation.
dddd Day of week as its full name.
M Month as digits with no leading zero for single-digit months.
MM Month as digits with leading zero for single-digit months.
MMM Month as a three-letter abbreviation.
MMMM Month as its full name.
y Year as last two digits, but with no leading zero for years less than 10.
yy Year as last two digits, but with leading zero for years less than 10.
yyyy Year represented by full four digits.
DateTime - a double-precision decimal DateTime value to be converted to a string expression representing the date. 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.

Examples

FormatDate("dddd, MMMM dd, yyyy.",39469.250) will return the string "Tuesday, January 22, 2008." 
 
FormatDate("M/d/y",39469.250) will return the string "1/22/8" 
 
FormatDate("dd-MM-yy",39469.250) will return the string "22-01-08" 
 
FormatDate("Next ddd is: MMM dd",39469.250) will return the string "Next Tue is: Jan 22"

Related articles