DataFormatString
来源:互联网 发布:医院数据安全管理制度 编辑:程序博客网 时间:2024/05/22 03:11
DataFormatString 属性语法如下:
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
- DateTime/DataFormatString
- DataFormatString格式化
- DataFormatString 属性
- DataFormatString格式化
- Datagrid DataFormatString
- DataFormatString,DataTextFormatString
- ASP.net DataFormatString
- DataFormatString--格式化字符串
- DataFormatString格式字符串
- 用DataFormatString格式化GridView
- DataFormatString格式字符串
- DataFormatString--格式化字符串
- js+层 效果(100分)
- Tomcat下应用JMS开发技巧
- C#对话框全接触
- weblogic 从数据库生成excel文件(打包发布方式)
- 使用OSWorkflow提供的Query API[转史蒂芬笔记]
- DataFormatString
- Agile Askme 0.5beta, an OWL based QA system has been released.
- 天乙社区8.0.0发布
- 视图中的OnCreate和OnInitialUpDate进行初始化有何不同?
- .net字符串加密
- apache-2.2.4 和 resin 3.0.22的整合
- C#多文档的窗体显示
- bash shell 的expr运算能支持实数运算吗?
- 链队列结构及操作