亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

基于ASP.NET實(shí)現(xiàn)日期轉(zhuǎn)為大寫(xiě)的漢字

Original 2017-01-12 11:44:21 447
abstract:這篇文章主要介紹的是利用ASP.NET將日期格式轉(zhuǎn)為大寫(xiě)漢字,比如: “2013年12月3日” 轉(zhuǎn)換成 “貳零壹叁年拾貳月叁日”,下面一起來(lái)看看怎么實(shí)現(xiàn)。一樣話不多說(shuō),直接上代碼//年份轉(zhuǎn)換為大寫(xiě)漢字   public static string numtoUpper(int num)    {  

這篇文章主要介紹的是利用ASP.NET將日期格式轉(zhuǎn)為大寫(xiě)漢字,比如: “2013年12月3日” 轉(zhuǎn)換成 “貳零壹叁年拾貳月叁日”,下面一起來(lái)看看怎么實(shí)現(xiàn)。

一樣話不多說(shuō),直接上代碼

//年份轉(zhuǎn)換為大寫(xiě)漢字
  public static string numtoUpper(int num)
   {
    return "零壹貳叁肆伍陸柒捌玖"[num].ToString();
   }
 
//月份轉(zhuǎn)換大寫(xiě)漢字
  public static string monthtoUpper(int month)
  {
   if (month < 10)
   {
    return numtoUpper(month);
   }
   else
   {
    if (month == 10) { return "壹拾"; }
 
    else
    {
     return "壹拾" + numtoUpper(month - 10);
    }
   }
  }
 
 
//日期轉(zhuǎn)化為大寫(xiě)漢字
  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()));
    }
   }
  }

更多關(guān)于基于ASP.NET實(shí)現(xiàn)日期轉(zhuǎn)為大寫(xiě)的漢字請(qǐng)關(guān)注PHP中文網(wǎng)(ipnx.cn)其他文章!

Release Notes

Popular Entries