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

推荐订阅源

量子位
小众软件
小众软件
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
C
Check Point Blog
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
罗磊的独立博客
有赞技术团队
有赞技术团队
V
V2EX
Y
Y Combinator Blog
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
F
Fortinet All Blogs
W
WeLiveSecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
MyScale Blog
MyScale Blog
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
PCI Perspectives
PCI Perspectives
H
Heimdal Security Blog
Schneier on Security
Schneier on Security
Security Latest
Security Latest
AWS News Blog
AWS News Blog
月光博客
月光博客
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
博客园 - Franky
Cisco Talos Blog
Cisco Talos Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
N
News and Events Feed by Topic
Cloudbric
Cloudbric
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
Attack and Defense Labs
Attack and Defense Labs

博客园 - DingJun

Javascript 继承方法3 Javascript 继承方法2 Javascript 继承方法1 Call web service from excel Cannot load type (加载页面出错) 几个主流的浏览器引擎及判定 防止数据库日志文件增长 配置发布数据库服务器时碰到错误18483 一些有关。NET界面处理与多线程的文章 不可恢复的生成错误 在.Net安装项目中如何判断操作系统的版本 修改dataConfiguration.config文件 SQL Server 使用外部连接 在.NET下利用目录服务操纵本机用户和用户组 System.windows.forms.datagrid控件使用技巧 读取配置文件中的自定义节 默认的 IIS MIME 类型关联 在.NET中使用XPath查找指定元素时遇到的麻烦(以dataConfiguration.config为例) 使用Data access block
区域设置与格式化(1)
DingJun · 2005-07-25 · via 博客园 - DingJun

格式化DataGrid的日期字段

用指定的输出格式来输出日期:
如下例所示:Indberetning的类型为日期(DateTime),要求输出短日期格式。

又如自定义输出格式, 2005-08-24:
DataBinder.Eval(Container,"DataItem.Indberetning","{0:yy-MM-dd}")

标准的日期格式: (Standard datatime format strings)

d 短日期格式 参考DateTimeFormatInfo.ShortDatePattern属性
D 长日期格式 参考DateTimeFormatInfo.LongDatePattern 属性
t 短时间格式 参考DateTimeFormatInfo.ShortTimePattern属性
T 长时间格式 参考DateTimeFormatInfo.LongTimePattern 属性
f 全日期格式(short time) Displays a combination of the long date and short time patterns, separated by a space.
F 全日期格式(long time) 参考DateTimeFormatInfo.FullDateTimePattern 属性
g General date/time pattern (short time) Displays a combination of the short date and short time patterns, separated by a space.
G General date/time pattern (long time) Displays a combination of the short date and long time patterns, separated by a space.
M or m Month day pattern 参考DateTimeFormatInfo.MonthDayPattern 属性
R or r RFC1123 pattern 参考 DateTimeFormatInfo.RFC1123Pattern属性
s Sortable date/time pattern; conforms to ISO 8601 参考DateTimeFormatInfo.SortableDateTimePattern 属性
u Universal sortable date/time pattern 参考DateTimeFormatInfo.UniversalSortableDateTimePattern属性
U Universal sortable date/time pattern 参考DateTimeFormatInfo.FullDateTimePattern 属性
Y or y Year month pattern 参考DateTimeFormatInfo.YearMonthPattern 属性

其他自定义日期格式(Custom Datetime format strings):

d 显示一位日期(显示9,不显示09)
dd 显示二位日期(显示09)
ddd 显示日期的缩略名,参考DateTimeFormatInfo.AbbreviatedDayNames属性
ddd 显示全日期
f 显示毫秒(一位)
ff 显示二位毫秒
fff 显示三位毫秒
ffff 显示四位毫秒
fffff 显示五位毫秒
ffffff 显示六位毫秒
fffffff 显示七位毫秒
h 显示小时(显示一位,1-12)
hh 显示小时(显示两位,1-12)
H 显示小时(显示一位,00-23)
HH 显示小时(显示两位,00-23)
m 显示分钟(显示一位,0-59),如5显示为5
mm 显示分钟(显示两位,0-59),如5显示为05
M 显示月(显示一位,1-12)
MM 显示月(显示两位,1-12),如5显示为05
MMM 显示月份的简称,参考DateTimeFormatInfo.AbbreviatedMonthNames属性
MMMM 显示月份的全称,参考DateTimeFormatInfo.MonthNames属性
s 显示秒(显示一位,0-59),如5显示为5
ss 显示秒(显示两位,0-59),如5显示为05
t 显示A.M/P.M的第一个字符,参考DateTimeFormatInfo.AMDesignator/PMDesignator属性
tt 显示A.M/P.M的全部,参考DateTimeFormatInfo.AMDesignator/PMDesignator属性
y 显示两位年,如2005显示为5
yy 显示两位年,如2005显示为05
yyyy 显示四位年,如2005显示为2005
z/zz/zzz,zzz 显示时区信息(详见MSDN)
g/gg 显示A.D.(公元)