//年份转换为大写汉字
public static string numtoUpper(int num)
{
return "零壹贰叁肆伍陆柒捌玖"[num].ToString();
} //月份转换大写汉字
public static string monthtoUpper(int month)
{
if (month < )
{
return numtoUpper(month);
}
else
{
if (month == ) { return "壹拾"; } else
{
return "壹拾" + numtoUpper(month - );
}
}
} //日期转化为大写汉字
public static string daytoUpper(int day)
{
if (day < )
{
return monthtoUpper(day);
}
else
{
String str = day.ToString();
if (str[] == '')
{
return numtoUpper(Convert.ToInt16(str[].ToString())) + "拾";
}
else
{
return numtoUpper(Convert.ToInt16(str[].ToString())) + "拾"
+ numtoUpper(Convert.ToInt16(str[].ToString()));
}
}
}
static void Main(string[] args)
{
string year = "";
string retur = string.Empty;
for (int i = ; i < year.Length; i++)
{
retur += numtoUpper(int.Parse(year[i].ToString())).ToString();
}
Console.WriteLine(retur + " 年");
retur = string.Empty;
string month = "";
retur = monthtoUpper(Convert.ToInt32(month));
Console.WriteLine(retur + " 月");
string day = "";
retur = daytoUpper(Convert.ToInt32(day));
Console.WriteLine(retur + " 日");
Console.ReadLine();
}

asp.net 日期转换为大写汉字的更多相关文章

  1. 将金额数字转换为大写汉字的js函数

    //将金额数字转换为大写汉字的函数 function convertCurrency(money) { //汉字的数字 var cnNums = new Array('零', '壹', '贰', '叁 ...

  2. JS将数字转换为大写汉字人民币

    <script language="jscript"> function convertCurrency(currencyDigits) { // Constants: ...

  3. C# 日期转换为中文大写

    /// <summary> /// 日期转换为中文大写 /// </summary> public class UpperConvert { public UpperConve ...

  4. python3.4.3将汉字转换为大写拼音首字母

    from pypinyin import pinyin a=pinyin(u'杨强',type=FIRST_LETTER)    --->此时返回一个列表并赋给a(元素也是列表) b=[]  - ...

  5. Java 毫秒转换为日期类型、日期转换为毫秒

    /毫秒转换为日期 public static void main(String[] args) { DateFormat formatter = new SimpleDateFormat(" ...

  6. 简单的分页存储过程,Json格式日期转换为一般日期

    简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count I ...

  7. 写一个方法完成如下功能,判断从文本框textbox1输入的一个字符,如果是数字则求该数字的阶乘,如果是小写字条,则转换为大写,大写字符不变,结果在文本框textbox2中显示

    窗体设计: 代码: using System; using System.Collections.Generic; using System.ComponentModel; using System. ...

  8. Date( )方法 章节中,你可以查看更多关于日期转换为字符串的函数

    在 Date 方法 章节中,你可以查看更多关于日期转换为字符串的函数: 方法 描述 getDate() 从 Date 对象返回一个月中的某一天 (1 ~ 31). getDay() 从 Date 对象 ...

  9. C# 把字符串类型日期转换为日期类型(转载)

    C# 把字符串类型日期转换为日期类型   来源:https://www.cnblogs.com/raincedar/p/7009243.html 方法一:Convert.ToDateTime(stri ...

随机推荐

  1. The input file was not found

    错误位置: File file= new File("/report/_test/test.xls");Workbook wb1 = jxl.Workbook.getWorkboo ...

  2. uC/OS-II 函数之邮箱管理相关函数

    上文主要介绍了消息队列相关的函数,本文介绍邮箱管理相关的函数:OSMboxCreate()建立一个邮箱,OSMboxDel()删除一个邮箱,OSMboxPend()等待邮箱中的消息,OSMboxPos ...

  3. Python爬取网上车市[http://www.cheshi.com/]的数据

    #coding:utf8 #爬取网上车市[http://www.cheshi.com/]的数据 import requests, json, time, re, os, sys, time,urlli ...

  4. Netty 5 获取客户端IP(非HTTP)

    使用Netty 5.0.0.Alpha2时,想知道客户端的ip以区分客户端,发现网上都是通过解析HTTP头域完成的,这里提供一种比较简单的方法. System.out.println("Cl ...

  5. [CoffeeScript]使用Yield功能

    CoffeeScript 1.9 开始提供了类似ES6的yield关键字. 自己结合co和bluebird做了个试验. co -- http://npmjs.org/package/co  -- fo ...

  6. 制作kvm镜像、格式转换

    2018-12-25 制作kvm镜像(以centos 7 为例) 执行创建虚拟机命令 virt-install --name centos7_kvm --memory --vcpus= --disk ...

  7. 读取P12格式证书的密钥

    不想存储p12证书内容,只想存储证书密钥,可通过以下实现读取证书的密钥出来: package com.zat.ucop.service.util; import org.apache.commons. ...

  8. 07-oracle多表查询

    --笛卡尔积,多表查询时,n张表中的行数相乘(本例中14*4=56)--多表查询时笛卡尔积无法消除,即使使用了限定条件(where)也只是不显示而已,实际上笛卡尔积仍存在 --只能使用合理的做法来处理 ...

  9. apache2 + django

    参照: http://blog.topspeedsnail.com/archives/7828 注意,当django安装在虚拟环境下时,配置文件里面需要有python-home 指向虚拟环境 WSGI ...

  10. ScriptManager.RegisterStartupScript失效的解决方案

    在项目中一个页面使用System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "success ...