zoukankan      html  css  js  c++  java
  • C# 格式化 中文星期 显示

    最近有些小忙,直接贴代码吧,

            /// <summary>
            /// 获取系统的星期
           /// </summary>
            /// <param name="dt">英文的星期</param>
            /// <returns>中文的星期几</returns>
            private static string GetWeek(string dt)
            {
                string week = "";
                //根据取得的英文单词返回汉字
                switch (dt)
                {
                    case "Monday":
                        week = "星期一";
                        break;
                    case "Tuesday":
                        week = "星期二";
                        break;
                    case "Wednesday":
                        week = "星期三";
                        break;
                    case "Thursday":
                        week = "星期四";
                        break;
                    case "Friday":
                        week = "星期五";
                        break;
                    case "Saturday":
                        week = "星期六";
                        break;
                    case "Sunday":
                        week = "星期日";
                        break;
                }
                return week;
            }‘
    ’
    
          static void Main(string[] args)
            {     
                   //获取当前是星期几,这里获取的是英文的星期几
                   string weekday = DateTime.Now.DayOfWeek.ToString();
                   Console.WriteLine(GetWeek(weekday));
            }
    View Code
  • 相关阅读:
    (floyd+DP) zoj 3027
    (树形DP) acdream 1028
    acdream 1032
    (BFS) acdream 1191
    (树形DP) bzoj 1060
    (状态压缩DP) poj 2978
    (DP) codeforces 358D
    (DP+二分) hdu 3433
    (最大生成树) hdu 3367
    hdoj 3501
  • 原文地址:https://www.cnblogs.com/duanchen/p/4464249.html
Copyright © 2011-2022 走看看