DataFormatString 转
设定BoundField的DataFormatString,通常有以下几种
DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Culture的设置
DataFormatString= "{0:E}" 科学计数法
DataFormatString= "{0: P}" 百分比
DataFormatString= "{0:F?}" 小数点后几位
DataFormatString= "{0:d}" M/d/yyyy 如 10/30/2008
DataFormatString= "{0:f}" 长日期,短时间。dddd,MMMM dd,yyyy HH:mm aa 如, Monday, January30, 2008 10:00am
DataFormatString= "{0: D}" 长日期。dddd,MMMM dd,yyyy 如: Monday,January 30,2008
DataFormatString= "{0:F}" 长日期,长时间 dddd,MMMM dd,yyyy HH:mm:ss aa
DataFormatString= "{0: s}" ISO 标准时间。yyyy-MM-ddTHH:mm:ss,如: 2008-01-30T10:20:55am
DataFormatString= "{0:M}" 月份和日期 MMMM dd,如January30
DataFormatString= "{0:G}" 一般格式 M/d/yyyy HH:mm:ss aa
-----------------------------------------------------------------
格式字符串 输入 结果
"{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
<%# String.Format("{0:yyyy-MM-dd} ", Eval("EffectiveDate "))%>
<%# String.Format("{0:yyyy-M-d} ", DataBinder.Eval(Container.DataItem, "EffectiveDate "))%>
DataFormatString 转的更多相关文章
- GridView的DataFormatString格式化字符串
DataFormatString="{0:格式字符串}" 0:代表字段本身 冒号后面的代表希望的格式 比如 {0:yyyy-MM-dd} 显示的时间类型就是2016-04-11 ...
- c# 数据绑定之 DataFormatString 格式
数据绑定之DataFormatString 设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货 ...
- 数据绑定之DataFormatString
设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Cultur ...
- GridView格式化数据DataFormatString
设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Cultur ...
- GridView和DataFormatString 日期格式 精确小数点后位数
如果DataFormatString无效,请添加属性 HtmlEncode = "false" --------------------------------------- Da ...
- Gridview利用DataFormatString属性设置数据格式
首 先把Gridview的AutoGenerateColumns属性设为False(默认是False),DataField选择相应的字段,特别需要注 意的是要把需要设置的字段的HtmlEncode属性 ...
- ASP.NET的gridview设置数据格式(DataFormatString="{}") 2011年04月08日 16:26:00 阅读数:5318 标签: asp.net datagrid integer asp date strin
select convert(numeric(8,2),round(UnTaxAmount,2))as UnTaxAmount from View_SaleVoiceselect cast(UnT ...
- gridview DataFormatString 属性设置须知
设置 DataFormatString 进行格式化数据时默认情况下是不会起作用的还有设置HtmlEncode = "false" 具体为什么?以下几点1. 在GridView中的a ...
- [转]数据绑定之DataFormatString
设定BoundField的DataFormatString,通常有以下几种 DataFormatString= "{0:C}" 货币,货币的格式取决于当前Thread中Cultur ...
随机推荐
- easyui dialog iframe
function toGrant(obj,url,showMsg) { var dialog=$('#dlg_grant' ...
- c++打开浏览器
调用外部命令 如果用默认浏览器,就调用ShellExecute(NULL, _T("open"), _T("explorer.exe"), _T("h ...
- 【前端】Ember.js学习笔记
Model 在默认情况下,model钩子返回的值,会设置为关联的控制器的model属性.例如,如果App.PostsRoute通过model钩子返回了一个对象,这个对象会设置为App.PostsCon ...
- React Native for Android 学习笔记
C:\Users\Vic Lee\AwesomeProject>react-native run-android Starting JS server... Running D:\Android ...
- 复旦高等代数 I(16级)思考题
思考题的说明 一.本学期高代I的思考题面向16级的同学,将不定期地进行更新; 二.欢迎16级的同学通过微信或书面方式提供解答图片或纸质文件给我,优秀的解答可以分享给大家: 三.请大家先独立解答思考题, ...
- Using FreeMarker templates (FTL)- Tutorial
Lars Vogel, (c) 2012, 2016 vogella GmbHVersion 1.4,06.10.2016 Table of Contents 1. Introduction to F ...
- linux开发摘要
1.linux内核文档链接点击打开链接 2.配置文件 在out\target\product\project\obj\KERNEL_OBJ\.config中可以看到 # CONFIG_MTD_LPDD ...
- EXCEL表格实现万位分隔符效果!
单击单元格右键 选择自定义单元格格式 选择数字标签 选择自定义 在输入框中输入:###","#### 单击确定即可! 格式刷可以对其他单元格实行同样效果!
- Linux网络配置基础
linux网络配置常见有两种:桥接模式(Bridge)与NAT模式,还有一种Host-Only模式由于其局限性通常被舍弃就不加以说明了,下面我们介绍下桥接模式(Bridge)和NAT模式. 桥接模式( ...
- GOLANG SDK下载
如果没有FQ的话是不能访问国外网站的,但是golang提供了中国站点,要下载sdk可以在中国站点下载 中国站点: http://www.golangtc.com/download