Convert the date to a Chinese digit

Source: Internet
Author: User
Using system; using system. web; using system. text; using system. text. regularexpressions; namespace DC {class dateconvertor {Private Static dateconvertor m_dateconvert = NULL; private char [] strchinese; private dateconvertor () {strchinese = new char [] {'〇 ', '1', '2', '3', '4', '5', '6', '7', '8', '9 ', '10'};} public static dateconvertor instance {get {If (m_dateconvert = NULL) m_dateconvert = new dateconvertor (); Return m_dateconvert;} Public String tochineseyear (INT year) {stringbuilder result = new stringbuilder (); string syear = year. tostring (); foreach (char C in syear) {int I = 0; Int. tryparse (C. tostring (), Out I); result. append (strchinese [I]);} return result. tostring ();} Public String tochinesedayormonth (INT day) {stringbuilder result = new stringbuilder (); string SDAY = Day. tostring (); For (INT I = 0; I <SDAY. length; ++ I) {char c = SDAY [I]; int TMP = 0; Int. tryparse (C. tostring (), Out TMP); If (SDAY. length = 1) {result. append (strchinese [TMP]);} else if (SDAY. length = 2) {if (I = 0) {If (TMP> 1) result. append (strchinese [TMP]); result. append ("Ten");} else if (I = 1) {If (TMP> 0) result. append (strchinese [TMP]) ;}} return result. tostring ();}}}

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: 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.