How to get the day of the week in ASP _ Application Tips

Source: Internet
Author: User
Tags numeric numeric value

The test code is as follows, please run this example using IE

Copy Code code as follows:

<script language= "VBScript" >
D=now
Xqj=weekday (d)
MsgBox Xqj ' output number, Sunday is 1, Monday is 2 ... By analogy, Saturday is 7.
MsgBox WeekdayName (XQJ)
</script>

Weekday Purpose: Returns the number of weeks of a date. By default, its value is an integer between 1 (Sunday) and 7 (Saturday).

Weekday is a function in Visual Basic and VBS that returns an integer representing the day of the week.

Grammar

Copy Code code as follows:
Dim x
X=weekday (Date[,firstdayofweek])

Parameters

The syntax for the weekday function has the following parameters:

Parameters Describe
Date
Must be selected. An arbitrary expression that can represent a date.
If NULL is included in the date argument, NULL is returned
FirstDayOfWeek
Optional. Specifies the constant for the first day of the week.
If omitted, default uses Vbsunday

Parameter Setting value

The FirstDayOfWeek parameter has the following settings:

Constant Value Describe
Vbusesystem 0 Use the regional language Support (NLS) API settings
Vbsunday 1 Sunday
Vbmonday 2 Monday
Vbtuesday 3 Tuesday
Vbwednesday 4 Wednesday
Vbthursday 5 Thursday
Vbfriday 6 Friday
Vbsaturday 7 Saturday

The Weekday function returns the following values:

Constant Value Describe
Vbsunday 1 Sunday
Vbmonday 2 Monday
Vbtuesday 3 Tuesday
Vbwednesday 4 Wednesday
Vbthursday 5 Thursday
Vbfriday 6 Friday
Vbsaturday 7 Saturday

WeekdayName is used to return a string representing the day of the week.

Grammar

WeekdayName (Weekday, abbreviate, FirstDayOfWeek)

The WeekdayName function syntax has the following parts:


Weekday is required. A numeric value that represents the day of the week. The numeric value depends on the setting value in the FirstDayOfWeek setting.

Abbreviate is optional. A Boolean value that indicates whether the name of the week is abbreviated. If this value is omitted, the default value is False, indicating that the name of the week cannot be abbreviated.

FirstDayOfWeek is optional. A numeric value that represents the first day of the week. See the "Set Values" section for their values.


The FirstDayOfWeek parameter values are as follows:
Constant numerical description
Vbusesystem 0 Sets the value using the native language support (NLS) API.
Vbsunday 1 week day (default).
Vbmonday 2 weeks A
Vbtuesday 3 week Two
Vbwednesday 4 week Three
Vbthursday 5 week Four
Vbfriday 6 Friday
Vbsaturday 7 Saturday

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.