Date formatting problems in ASP

Source: Internet
Author: User
Tags expression locale access database
For dates that are stored in the date-time Type field of an Access database, the effect that is read directly from the database is shown with time, such as, 2009-06-13 18:00, what if just want to show the date?


Vbscrip has a function formatdatetime (). The description is as follows:


returns an expression that has been formatted as a date or time.


FormatDateTime (date[, NamedFormat])


parameter


Date


required option. The date expression to be formatted.


NamedFormat


can be selected. Indicates the value of the date/time format used, and if omitted, uses Vbgeneraldate.


Settings

The
NamedFormat parameter can have the following values:
constant value
vbgeneraldate 0 shows the date and/or time. If there is a date part, the section is displayed as a short date format. If there is a time section, the section is displayed in a long time format. If all exist, all parts are displayed.
vblongdate 1
vbshortdate 2
Vblongtime 3 Show time in the time format specified in the computer locale.
vbShortTime 4 use 24-hour format (hh:mm) Displays the time.
Only the following code is available when you want to display the date: Strdate=formatdatetime (RS ("date"), 2). Because there is only one computer area in VBScript that is the United States, so there is only one short form of "YYYY-MM-DD".
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.