FormatDateTime Function


FormatDateTime Function

Class

Microsoft.VisualBasic.Strings

Syntax

     Dim result As String = FormatDateTime(expression[, dateFormat]) 


expression (required; Date)

The date to be formatted.


dateFormat (optional; DateFormat enumeration)

Defines the format of the date to return. One of the following Microsoft.VisualBasic.DateFormat enumeration values.

Value

Description

GeneralDate

Displays the date and time using the "Short Date" and "Long Time" formats together. Either the date or time may be omitted if unset.

LongDate

Displays the date using the regionally defined "Long Date" format.

ShortDate

Displays the date using the regionally defined "Short Date" format.

LongTime

Displays the time using the regionally defined "Long Time" format.

ShortTime

Displays the time using a 24-hour format of "hh:mm."


If omitted, GeneralDate is used.

Description

The FormatDateTime function formats a date or time expression based on the computer's regional settings.

Usage at a Glance

The following two statements are identical:

     niceDate = FormatDateTime(sourceDate, DateFormat.LongDate)     niceDate = Format(sourceDate, "Long Date") 

See Also

Format Function, FormatCurrency, FormatNumber, FormatPercent Functions




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net