惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
S
Security Affairs
S
Secure Thoughts
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Heimdal Security Blog
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Spread Privacy
Spread Privacy
C
Cybersecurity and Infrastructure Security Agency CISA
Latest news
Latest news
T
Tor Project blog
I
Intezer
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Project Zero
Project Zero
V2EX - 技术
V2EX - 技术
V
Vulnerabilities – Threatpost
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
T
Threat Research - Cisco Blogs
Webroot Blog
Webroot Blog
T
Threatpost
Help Net Security
Help Net Security
W
WeLiveSecurity
Know Your Adversary
Know Your Adversary
WordPress大学
WordPress大学
L
LINUX DO - 最新话题
月光博客
月光博客
PCI Perspectives
PCI Perspectives
小众软件
小众软件
爱范儿
爱范儿
博客园 - Franky
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
Scott Helme
Scott Helme
P
Privacy International News Feed
Y
Y Combinator Blog
P
Palo Alto Networks Blog
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium

博客园 - xixi8820

输入框验证输入数字的js 关于VS2005中GridView的自定义分页,单选、多选、排序、自增列的简单应用(转载的) 使用t-sql从身份证号中提取生日(转自别人,个人学习收藏用) 一个最简单的登录例子 js中setTimeout与setInterval的区别 js将html中的内容导出word、或者excel文件的方法 javascript 获得指定日期的临近日期的方法 asp.net 2.0 生成验证码 ASP.NET中App_Code,App_Data等文件夹的作用 javascript 客户端验证 在DataGrid中模版列显示图片 上传图片 页面取物理路径和几种获取asp.net应用程序的路径 模式窗口关闭,并刷新父窗口的方法 跨页面实现多选 用window.location.href实现刷新另个框架页面 听说是个高效的分页存储过程,可以轻松应对百万数据(转) keycode 值 DataGrid点击删除按钮弹出对话框的问题
在Asp.Net中应用DataFormatString
xixi8820 · 2007-12-05 · via 博客园 - xixi8820

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

注意:在ASP.NET 2.0中应设置HtmlEncode为false,否则DataFormatString不起作用
例:<asp:BoundField DataField="SubTime" DataFormatString="{0:f}" HeaderText="SubTime"
            SortExpression="SubTime" HtmlEncode="False" />