Please enable JavaScript to view this site.

 

str = FormatDate(sFormat,nDate)

 

This macro function converts the date nDate into a string using the format sFormat.

sOut = FormatDate('"Printed on: " d-mmm-yyy', nToday)

The format string can be made up of a combination of the following:

 

d

Day as a number without a leading zero (1-31).

dd

Day as a number with a leading zero (01-31).

ddd

Day as an abbreviation using the value of the [ddd] token for the language of the incoming macro token. The following case variations are possible: 'ddd', 'Ddd' and 'DDD'.

dddd

Day as a full name using the value of the [dddd] token for the language of the incoming macro token. The following case variations are possible: 'dddd', 'Dddd' and 'DDDD'.

m

Displays the month as a number without a leading zero (1-12).

mm

Displays the month as a number with a leading zero (01-12).

mmm

Month as an abbreviation using the value of the [mmm] token for the language of the incoming macro token. The following case variations are possible: 'mmm', 'Mmm' and 'MMM'.

mmmm

Month as a full name using the value of the [mmmm] token for the language of the incoming macro token. The following case variations are possible: 'mmmm', 'Mmmm' and 'MMMM'.

yy

Displays the year as a two-digit number (00-99).

yyyy

Displays the year as a four-digit number (0000-9999).

 

To include text whose letters you do not wish to have interpreted, such as "Printed on:" where the d is not the date, include that text in double quotes within the format string (see example above).

 

See also: FormatNumber, FormatParagraph, FormatText, and FormatTime.

 


Topic 108259, last updated on 18-Apr-2020