Convert dates to uppercase Chinese Characters Based on ASP. NET, and convert asp.net to uppercase

Source: Internet
Author: User

Convert dates to uppercase Chinese Characters Based on ASP. NET, and convert asp.net to uppercase

This article mainly introduces the use of ASP. NET converts the date format to uppercase Chinese characters, for example, "may" to "may, May". Let's take a look at how it works.

Let's not talk about the same thing. directly add the code.

// Convert the year to an uppercase Chinese Character public static string numtoUpper (int num) {return "Zero errors" [num]. toString ();} // converts the uppercase Chinese character "public static string monthtoUpper (int month) {if (month <10) {return numtoUpper (month );} else {if (month = 10) {return "";} else {return "" + numtoUpper (month-10 );}}} // convert the date to the uppercase Chinese Character public static string daytoUpper (int day) {if (day <20) {return monthtoUpper (day);} else {String str = day. toString (); if (str [1] = '0') {return numtoUpper (Convert. toInt16 (str [0]. toString () + "pick";} else {return numtoUpper (Convert. toInt16 (str [0]. toString () + "pick" + numtoUpper (Convert. toInt16 (str [1]. toString ()));}}}
Static void Main (string [] args) {string year = "2013"; string retur = string. empty; for (int I = 0; I <year. length; I ++) {retur + = numtoUpper (int. parse (year [I]. toString ())). toString ();} Console. writeLine (retur + "year"); retur = string. empty; string month = "12"; retur = monthtoUpper (Convert. toInt32 (month); Console. writeLine (retur + "month"); string day = "3"; retur = daytoUpper (Convert. toInt32 (day); Console. writeLine (retur + "day"); Console. readLine ();}

The above is the use of ASP. NET to convert all the content of the date format into uppercase Chinese characters, I hope the content of this article will be helpful for everyone to use ASP. NET.

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.