FormatDate()
Syntax
Text$ = FormatDate(Mask$, Date)Description
Returns a string representation of the given Date.
Parameters
Mask$ The mask used to format the date. The following tokens in the mask string will be replaced according to the given date: %yyyy: Will be replaced by the year value, on 4 digits. %yy: Will be replaced by the year value, on 2 digits. %mm: Will be replaced by the month value, on 2 digits. %dd: Will be replaced by the day value, on 2 digits. %hh: Will be replaced by the hour value, on 2 digits. %ii: Will be replaced by the minute value, on 2 digits. %ss: Will be replaced by the second value, on 2 digits.Date The date value to use.
Return value
Returns the mask string with all tokens replaced by the date values.
Example
Debug FormatDate("Y=%yyyy, M= %mm, D=%dd", Date()) ; Will display the actual date with ; the form "Y=2010, M=01, D=07" Debug FormatDate("%mm/%dd/%yyyy", Date()) ; Will display the actual date with ; the form "01/07/2010" Debug FormatDate("%hh:%ii:%ss", Date()) ; Will display the time using the 00:00:00 format
See Also
Date(), ParseDate()
Supported OS
All