asp.net 日期转换为大写汉字
//年份转换为大写汉字
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 日期转换为大写汉字的更多相关文章
- 将金额数字转换为大写汉字的js函数
//将金额数字转换为大写汉字的函数 function convertCurrency(money) { //汉字的数字 var cnNums = new Array('零', '壹', '贰', '叁 ...
- JS将数字转换为大写汉字人民币
<script language="jscript"> function convertCurrency(currencyDigits) { // Constants: ...
- C# 日期转换为中文大写
/// <summary> /// 日期转换为中文大写 /// </summary> public class UpperConvert { public UpperConve ...
- python3.4.3将汉字转换为大写拼音首字母
from pypinyin import pinyin a=pinyin(u'杨强',type=FIRST_LETTER) --->此时返回一个列表并赋给a(元素也是列表) b=[] - ...
- Java 毫秒转换为日期类型、日期转换为毫秒
/毫秒转换为日期 public static void main(String[] args) { DateFormat formatter = new SimpleDateFormat(" ...
- 简单的分页存储过程,Json格式日期转换为一般日期
简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count I ...
- 写一个方法完成如下功能,判断从文本框textbox1输入的一个字符,如果是数字则求该数字的阶乘,如果是小写字条,则转换为大写,大写字符不变,结果在文本框textbox2中显示
窗体设计: 代码: using System; using System.Collections.Generic; using System.ComponentModel; using System. ...
- Date( )方法 章节中,你可以查看更多关于日期转换为字符串的函数
在 Date 方法 章节中,你可以查看更多关于日期转换为字符串的函数: 方法 描述 getDate() 从 Date 对象返回一个月中的某一天 (1 ~ 31). getDay() 从 Date 对象 ...
- C# 把字符串类型日期转换为日期类型(转载)
C# 把字符串类型日期转换为日期类型 来源:https://www.cnblogs.com/raincedar/p/7009243.html 方法一:Convert.ToDateTime(stri ...
随机推荐
- python 常用模块大全
1.getpass 模块 一般用于获取用户输入的密码 import getpass pwd = getpass.getpass('input your pass') print(pwd) print ...
- [转]IOS应用程序多语言本地化解决方案
最近要对一款游戏进行多语言本地化,在网上找了一些方案,加上自己的一点点想法整理出一套方案和大家分享! 多语言在应用程序中一般有两种做法:一.程序中提供给用户自己选择的机会:二.根据当前用户当前移动设备 ...
- SyntaxError: Non-UTF-8 code starting with '\xb6' in file XX.py
导致出错的根源就是编码问题. 解决方案是: 在程序最上面加上: # coding=gbk
- Golang开发环境搭建
1.下载golang安装包: 下载地址:https://golang.google.cn/dl/ 2.安装Eclipse 下载goclipse 插件 3.配置 Go 的编译器 4.写代码. packa ...
- logback 发送邮件的类.
类名 : SMTPAppenderBase方法名: sendBuffer
- idea validation code
K71U8DBPNE-eyJsaWNlbnNlSWQiOiJLNzFVOERCUE5FIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiI ...
- mysql 03
CREATE TABLE class( empno INT, ename VARCHAR(4), job VARCHAR(4), mgr INT, hiredate DA ...
- LinuxShell脚本编程基础2-变量与数值运算、父shell和子shell
1.变量和数值运算 Shell脚本的变量不需要声明的 对变量赋值有两种方式, 直接用“=” 或者用键盘输入值 #!/bin/bash name1="Jack" echo $name ...
- Apache和Tomcat的整合过程(转载)
一 Apache与Tomcat比较联系 apache支持静态页,tomcat支持动态的,比如servlet等. 一般使用apache+tomcat的话,apache只是作为一个转发,对jsp的处理是由 ...
- unity接入安卓sdk (unity调用安卓工程)
1.安装jdk 并且配置环境,这个网上资料很多,这里不说了 2.安卓开发软件eclipse集成环境版 下载地址 http://tools.android-studio.org/index.php/ad ...