Tuesday, January 4, 2022

Formatdatetime function

Returns an expression formatted as a date or time.

Syntax

FormatDateTime( Date [, NamedFormat ] )

The FormatDateTime function syntax has these arguments:

Argument

Description

Date

Required. Date expression to be formatted.

NamedFormat

Optional. Numeric value that indicates the date/time format used. If omitted, vbGeneralDate is used.

Settings

The NamedFormat argument has the following settings:

Constant

Value

Description

vbGeneralDate

0

Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed.

vbLongDate

1

Display a date using the long date format specified in your computer's regional settings.

vbShortDate

2

Display a date using the short date format specified in your computer's regional settings.

vbLongTime

3

Display a time using the time format specified in your computer's regional settings.

vbShortTime

4

Display a time using the 24-hour format (hh:mm).

Examples

Expression

Results

SELECT FormatDateTime([DateTime],0) AS Expr1 FROM ProductSales;

Formats and displays the date values in "DateTime" field into Date and/or time.

SELECT FormatDateTime([DateTime],1) AS NewDate FROM ProductSales;

Formats and displays the date values in "DateTime" field as Long Date format. Formats and displays the date values in "DateTime" field as Short Date format.

SELECT FormatDateTime([DateTime],3) AS NewDate FROM ProductSales;

Formats and displays the date values in "DateTime" field as "Time" format (without the date).

SELECT FormatDateTime([DateTime],4) AS NewDate FROM ProductSales;

Formats and displays the date values in "DateTime" field as 24hour "Time" format (without the date).

1 comment:

  1. Hello guys, I just want to share my joyful experience about HACK VANISH CREDIT SPECIALIST. Before the coronavirus pandemic, I had criminal Judgments, few evictions, and late payment which negatively impacted my credit score down to 487 and left me in difficult financial situation, as a single mum of 3, I needed a loan to keep the family running after I lost my husband as a result of COVID-19, all hope were lost, until Mrs. Olivia referred me to HACK VANISH, a credit genius who was very helpful in fixing my credit 6 days after I reached out to him via Email: hackvanish (At) gmail (Dot) com and Phone: +1(747) 293-8514, throughout the process, I felt so involved because an open line of communication was maintained till I got my FICO score restored to 796, currently my loan application has been approved. If you need to hire a credible hacker, HACK VANISH is highly recommended.

    ReplyDelete