Format

Under Format Function, the Visual Basic 5 Help file says that the Format function “Returns a Variant(String) containing an expression formatted according to instructions contained in a format expression.” In the current context, the Format and Format$ functions are used to “convert” a date to a different date format.

Return value The return type of the Format function depends on the data type of the receiving variable and the particular formatting being applied to the expression argument.

Arguments Visual Basic versions 4 and 5 have some extra “first day of the week” type arguments that are not relevant to Y2K issues. The main arguments of the Format function are Expression, which is any valid expression, and Format, which is the formatting that should be applied to Expression.

Y2K issues In Visual Basic 3, if you use a short date as an expression, Visual Basic will assume the 1900s, even if the system date is past the year 2000. For example, the following code will display “January 01, 1900” (depending on your locale):

MsgBox Format("1/1/0", "Long Date")

Visual Basic 4 on the other hand will assume the current century. As I’ve mentioned before, this is no real advantage for applications that process historical dates.