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 ...
随机推荐
- iOS开发之像素Compositing
假如Layer S·在Layer D上面,则最终的屏幕的颜色值如下: \[R = S + D \cdot (1- S_\alpha)\] \(R\): 最终的RGB \(S\): source col ...
- UIView-frame-VS-bounds
分享链接
- UDF-Java提取身份证内信息
1.使用方法 #获取省份ID create temporary function getProvIdByCardIdUDF as 'com.st.PersonInfoByCardIdUDF.getPr ...
- 题目1021:统计字符(hash简单应用)
问题来源 http://ac.jobdu.com/problem.php?pid=1021 问题描述 每次输入两个字符串,统计第一个字符串中的每个字符在第二个字符串中出现的次数. 问题分析 太明显了, ...
- HTML-文本域属性设置
1.设置文本域的字体 <TEXTAREA STYLE="font-size:9pt;font-family:verdana;color:#333333">输入内容< ...
- [原创]PHP 异常错误处理
目录 错误与异常 异常类 错误类(PHP >= 7) 错误 错误报告级别 错误报告设置 全局异常处理程序 全局错误处理函数 无法捕获的错误类型 范例代码 开发/生产环境处理错误和异常 开发环境 ...
- crontab例行性共作
一.单一工作调度 at [-mldv] TIME at -c 工作号码 -m:当at工作结束后,即是没有输出信息,以email通知用户该工作已完成 -l:at -l相当于atq,列出目前系统上所有的a ...
- django-获取当前url和ip
1.添加'django.template.context_processors.request', 2.在模板的html中输入 {{ request.path}}{{ request.get_host ...
- border.css(解决移动端1px问题)
由于某些机型分辨率过高,会导致1px变成2-多px像素的问题,引用bordercss解决 @charset "utf-8"; .border, .border-top, .bord ...
- IONIC 打包安卓apk详细过程
参照以下链接: https://blog.csdn.net/qq_20264891/article/details/79319408 当 cordova 项目安装的 android 平台版本 与 系统 ...