C # display the Chinese day of the week in a lable:
Drag the label on the page and name it labweek.
This. labweek. Text = system. Date. Now. dayofweek. tostring (); // convert the current date to the day of the week)
This. labweek. Text = convertdayofweektozh (system. datetime. Today. dayofweek); // convert the English day of the week to Chinese
# Region converts the English day of the week to Chinese
///
/// Convert the English day of the week into Chinese
///
///
///
Public static string convertdayofweektozh (system. dayofweek DW)
{
String dayofweekzh = "";
Switch (DW. tostring ("D "))
{
Case "0 ":
Dayofweekzh = "Sunday ";
Break;
Case "1 ":
Dayofweekzh = "Monday ";
Break;
Case "2 ":
Dayofweekzh = "Tuesday ";
Break;
Case "3 ":
Dayofweekzh = "Wednesday ";
Break;
Case "4 ":
Dayofweekzh = "Thursday ";
Break;
Case "5 ":
Dayofweekzh = "Friday ";
Break;
Case "6 ":
Dayofweekzh = "Saturday ";
Break;
}
Return dayofweekzh;
}
# Endregion
Datetime. Now. dayofweek is in English.
Finally, I converted it! Let's take it out and share it with you!
I.
String [] day = new string [] {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday "};
Console. writeline (day [convert. toint16 (datetime. Now. dayofweek)]);
II.
Const string day = "May 15, 1234 ";
Console. writeline ("Week" + day [convert. toint16 (datetime. Now. dayofweek)]);