Format$

String = Format$ ( Expression [ , Format ] ) String = Format ( Expression [ , Format ] )

Converts the Expression to a String by using a format that depends on the type of the Expression .

This function can format dates, times, numbers, and currencies.

Format can be: See Predefined Constants for a list of predefined formats, and User-defined formats for the syntax used by the Format string.

This function uses localization information. It is intended to format date according to the current language.

If you want to use Format() to generate a date with a specific format, do not forget to quote the special format characters like "/" and ":".

Examples

Dim dDate As Date = Now
PRINT Format(dDate,"dddd dd/mm/yyyy hh:nn:ss")
Friday 15/02/2019 00:18:14

See also