FormatDate

Navigation:  Appendices > Macro Language > Built-in Functions > All Functions (Alphabetical) >

FormatDate

Previous pageReturn to chapter overviewNext page

str = FormatDate(sFormat,nDate)

 

This macro function uses Windows internal constants to format dates.

 

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

 

As you may be aware these settings can easily be changed by any user going into the control panel. We therefore urge extreme caution in using this function as results may vary from one workstation to the other. The main use of this function is therefore to produce datestamps outside of the trimmed area of the diary, to mark the output file time, or the due date or any other date. It has the advantage that it will display these dates in your own language, even if the body of the diary is in another language.

 

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

 

c

Date using the format given by the ShortDateFormat global variable.

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 ShortDayNames global variable.

dddd

Day as a full name using the LongDayNames global variable.

ddddd

Date using the format given by the ShortDateFormat global variable.

dddddd

Date using the format given by the LongDateFormat global variable.

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 ShortMonthNames global variable.

mmmm

Month as a full name using the LongMonthNames global variable.

yy

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

yyyy

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

 

Note

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

Format specifiers may be written in upper case as well as in lower case letters; both produce the same result.

If the string given by the Format parameter is empty, the date and time value is formatted as if a 'c' format specifier had been given.


Topic 108259 updated on 01-Nov-2016.
Topic URL: http://www.qppstudio.net/webhelp/index.html?formatdate.htm