In Visual Basic 6.0, to display a short or long date, you use either the "ddddd" or "dddddd" format specifier. The DayOfWeek ("w") and WeekOfYear ("ww") specifiers display the day considered to be the first day of the week, and the week considered to be the first week of the year. The lowercase "m" character displays the month as a number without a leading zero. The Quarter specifier ("q") displays the quarter of the year as a number from 1 to 4.
To display a minute as a number with or without leading zeros, you use either the "Nn" or the "N" format specifier. The characters "Hh" display the hour as a number with leading zeros, and "ttttt" displays the time as a complete time. To display either an uppercase or lowercase "A" or "P" with any hour before or after noon, you use either "AM/PM", "am/pm", "A/P", "a/p", or "AMPM."
The short date/time specifier ("c") displays a date and time in the "ddddd ttttt" format.
In Visual Basic 2005, "ddddd" and "dddddd" behave the same as "dddd", displaying the full name of the day. They do not display the short date and long date. DayOfWeek ("w") and WeekOfYear ("ww") are not supported. Instead, you can use the DatePart function, as the following example shows.
Format(DatePart(DateInterval.Weekday, Now))
<br /><span space="preserve">...</span><br /> Format(DatePart(DateInterval.WeekOfYear, Now))
"M" and "m" mean different things, so they are case sensitive. Use uppercase "M" only for the month in the date portion of a date/time format, and lowercase "m" only for the minutes in the time portion.
The Quarter format specifier is not supported. Instead, you can use the DatePart function, as the following example shows.
Format(DatePart(DateInterval.Quarter, Now))
To display the minute as a number with or without leading zeros, use "mm" or "m", respectively. The "ttttt" format is no longer supported. "H" and "h" mean different things, so they are case sensitive. Use uppercase "H" only for a 24-hour clock, and lowercase "h" only for a 12-hour clock. The AM/PM formats are replaced with "t" and "tt."
The "c" specifier is used for currency formatting. For date/time formatting, use "g" for the short date/time specifier and "G" for the general date/time specifier. Both "g" and "G" use your current locale setting to determine the appropriate date and time formats.