DataFormatString--格式化字符串
来源:互联网 发布:社交网络下载 编辑:程序博客网 时间:2024/05/01 05:26
DataFormatString--格式化字符串
还要设置HtmlEncode="False"
DataFormatString="{0:格式字符串}"
在DataFormatString 中的 {0} 表示数据本身,而在冒号后面的格式字符串代表所们希望数据显示的格式;
数字、货币格式:
在指定的格式符号后可以指定小数所要显示的位数。例如原来的数据为「1.56」,若格式设定为 {0:N1},则输出为「1.5」。其常用的数值格式如下表所示:
格式字符串 输入 结果
"{0:C}" 12345.6789 $12,345.68
"{0:C}" -12345.6789 ($12,345.68)
"{0:D}" 12345 12345
"{0:D8}" 12345 00012345
"{0:E}" 12345.6789 1234568E+004
"{0:E10}" 12345.6789 1.2345678900E+004
"{0:F}" 12345.6789 12345.68
"{0:F0}" 12345.6789 12346
"{0:G}" 12345.6789 12345.6789
"{0:G7}" 123456789 1.234568E8
"{0:N}" 12345.6789 12,345.68
"{0:N4}" 123456789 123,456,789.0000
"Total: {0:C}" 12345.6789 Total: $12345.68
常用的日期时间格式:
格式 说明 输出格式
d 精简日期格式 MM/dd/yyyy
D 详细日期格式 dddd, MMMM dd, yyyy
f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm
F
完整日期时间格式
(long date + long time)
dddd, MMMM dd, yyyy HH:mm:ss
g 一般格式 (short date + short time) MM/dd/yyyy HH:mm
G 一般格式 (short date + long time) MM/dd/yyyy HH:mm:ss
m,M 月日格式 MMMM dd
s 适中日期时间格式 yyyy-MM-dd HH:mm:ss
t 精简时间格式 HH:mm
T 详细时间格式 HH:mm:ss
- DataFormatString--格式化字符串
- DataFormatString--格式化字符串
- DataFormatString--格式化字符串
- DataFormatString--格式化字符串
- DataFormatString--格式化字符串
- DataFormatString格式化字符串的总结
- DataFormatString格式化字符串的总结
- DataFormatString格式化字符串的总结
- DataFormatString--格式化字符串 、常用正则表达式
- DataFormatString--格式化字符串 、常用正则表达式
- DataFormatString格式化
- DataFormatString格式化
- 用DataFormatString格式化GridView
- DataFormatString格式化列信息
- DataFormatString的格式化
- 用DataFormatString格式化GridView
- 用DataFormatString格式化GridView
- 用DataFormatString格式化GridView
- .net相关概念
- inner join,outer join,left join,right join的区别
- 硬盘分区表
- 服务器控件生命周期
- 委托(C# 编程指南
- DataFormatString--格式化字符串
- 在asp.net中读取XML文件信息的4种方法 (http://www.cnblogs.com/liping19851014/archive/2007/10/16/926137.html)
- asp.net 返回上一页的实现方法小集
- 无刷新检测用户名
- 正则表达式30分钟入门教程
- Ajax联动实现省市联动
- sql 常用语句积累
- ASPX页生成静态HTML页(五种方案)
- url重写