C Simple Realization Method of Displaying Day of the Week in Chinese Format

  • 2021-10-27 08:42:18
  • OfStack

In this paper, an example is given to show the day of the week in Chinese format by C #. Share it for your reference, as follows:

1.

DateTime.Now.ToString("dddd",new System.Globalization.CultureInfo("zh-cn"));

2.

new string[] { " Sunday ", " Week 1", " Week 2", " Week 3", " Week 4", " Week 5", " Week 6", }[Convert.ToInt16(DateTime.Now.DayOfWeek.ToString("D"))];

3.


" Week "+DateTime.Now.DayOfWeek.ToString(("d"))

4.


/// <summary>
///  What is the date of return 
/// </summary>
/// <returns></returns>
public static string DayOfWeek
{
get
{
switch (DateTime.Now.DayOfWeek.ToString("D"))
{
case "0":
return " Sunday  ";
case "1":
return " Week 1 ";
case "2":
return " Week 2 ";
case "3":
return " Week 3 ";
case "4":
return " Week 4 ";
case "5":
return " Week 5 ";
case "6":
return " Week 6 ";
}
}
}

More readers interested in C # can check the topic of this site: "C # Form Operation Skills Summary", "C # Common Control Usage Tutorial", "WinForm Control Usage Summary", "C # Programming Thread Use Skills Summary", "C # Operating Excel Skills Summary", "XML File Operation Skills Summary in C #", "C # Data Structure and Algorithm Tutorial", "C # Array Operation Skills Summary" and "C # Object-Oriented Programming Introduction Tutorial"

I hope this article is helpful to everyone's C # programming.


Related articles: