(INT) datetime. Now. dayofweek number. If it is Wednesday, the result is 3.
Datetime. Now. tostring ("dddd", new system. Globalization. cultureinfo ("ZH-CN"); // display the Chinese week
Datetime. Now. tostring ("dddd"); // display of Chinese week
Datetime. Now. tostring ("dddd, Mmmm, DD, YYYY", new system. Globalization. datetimeformatinfo (); // display the date format Friday, July, 01,2009
Datetime. Now. tostring ("dddd, DD Mmmm, YYYY") // output on Wednesday, December 30, January, 2008
Source: http://msdn.microsoft.com/zh-cn/vstudio/bb762911 (vs.95). aspx, how to: extract the day of the week from a specific date
Set the format of datetime type in tostring () Format
Detailed format usage of the Parameter
Format character Association attributes/Description
D shortdatepattern
D longdatepattern
F complete date and time (long date and short time)
F fulldatetimepattern (long date and long time)
G regular (short date and short time)
G regular (short date and long time)
M, M monthdaypattern
R, R rfc1123pattern
S uses sortabledatetimepattern of the local time (based on ISO 8601)
T shorttimepattern
T longtimepattern
U universalsortabledatetimepattern is used to display the format of common time
U uses the complete date and time of the general time (long date and long time)
Y, y yearmonthpattern
The following table lists the modes that can be merged to build a custom mode. These modes are case sensitive.
D. A single-digit date has no leading zero.
A day in DD month. A single-digit date has a leading zero.
The abbreviation of a day in DDD Week, which is defined in abbreviateddaynames.
The full name of the Day of the dddd Week, which is defined in daynames.
M month number. One-digit month does not have a leading zero.
Mm Month number. A single-digit month has a leading zero.
The abbreviated name of the mmm month, which is defined in abbreviatedmonthnames.
The full name of the mmmm month, which is defined in monthnames.
Y does not contain the year of the epoch. If the year that does not contain the epoch is less than 10, the year that does not have the leading zero is displayed.
YY does not contain the year of the epoch. If the year that does not contain the epoch is less than 10, the year with the leading zero is displayed.
Yyyy includes the four-digit year of the epoch.
Gg period or epoch. This mode is ignored if the date to be formatted does not have an associated period or epoch string.
H 12-Hour. One-digit hours do not have a leading zero.
The hour in HH 12-hour format. The number of hours in a single digit has a leading zero.
H In 24-hour format. One-digit hours do not have a leading zero.
The hour in the 24-hour format. The number of hours in a single digit has a leading zero.
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