星空网 > 软件开发 > ASP.net

asp.net 日期转换为大写汉字

//年份转换为大写汉字    public static string numtoUpper(int num)     {       return "零壹贰叁肆伍陆柒捌玖"[num].ToString();     }//月份转换大写汉字    public static string monthtoUpper(int month)    {      if (month < 10)      {        return numtoUpper(month);      }      else      {        if (month == 10) { return "壹拾"; }        else        {          return "壹拾" + numtoUpper(month - 10);        }      }    }//日期转化为大写汉字    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())) + "拾";        }        else        {          return numtoUpper(Convert.ToInt16(str[0].ToString())) + "拾"            + 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 + " 年");      retur = string.Empty;      string month = "12";      retur = monthtoUpper(Convert.ToInt32(month));      Console.WriteLine(retur + " 月");      string day = "31";      retur = daytoUpper(Convert.ToInt32(day));      Console.WriteLine(retur + " 日");      Console.ReadLine();    }

 




原标题:asp.net 日期转换为大写汉字

关键词:ASP.NET

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

预测:阿联酋和沙特是全球黑五消费支出最多的国家:https://www.ikjzd.com/articles/134066
抓住商机!这五类产品圣诞节前将热卖,快点进来看看:https://www.ikjzd.com/articles/134067
跨境电商“黑五”攻略来了!:https://www.ikjzd.com/articles/134069
亚马逊连出2个新政策!A-Z指标被取消?:https://www.ikjzd.com/articles/13407
学会这个方法,做2020年“黑五”自然流量收割机!:https://www.ikjzd.com/articles/134070
加拿大市场潜力:2022年,将有2834万在线购物者:https://www.ikjzd.com/articles/134072
三百元以内千兆路由器怎么选择?:https://www.vstour.cn/a/363184.html
千岛湖绿城度假酒店的简介:https://www.vstour.cn/a/363185.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流