Simple implementation of. Net Chinese day of the week

Source: Internet
Author: User

According to our Chinese habits, in daily use, what is the week ?" Instead of Sunday, Monday ,... This form of e-text.

. Net returns the day of the week, usually in the form of dayofweek Enum, the return is 0 ~ The value of 6. It is Sunday by default ~ Saturday.

If you want to return the day of the week for Chinese habits, you only need to make a simple conversion:

  // DT indicates the date of the day of the week to be returned.   /// the following implementation method is adopted. The first day of each week is Sunday (Sunday) by default.   Public   static   string  cnweekdayname (datetime DT) { string  [] cnweekdaynames = {"  day  ", " 1 ", " 2  ", " 3 ", " 4  ", " 5 ", " 6  "};  return  " week " + cnweekdaynames [( int ) dt. dayofweek] ;}
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.