DataFormatString 转
設(shè)定BoundField的DataFormatString,通常有以下幾種?
DataFormatString= "{0:C}" 貨幣,貨幣的格式取決于當(dāng)前Thread中Culture的設(shè)置?
DataFormatString= "{0:E}" 科學(xué)計(jì)數(shù)法?
DataFormatString= "{0: P}" 百分比?
DataFormatString= "{0:F?}" 小數(shù)點(diǎn)后幾位?
DataFormatString= "{0:d}" M/d/yyyy 如 10/30/2008?
DataFormatString= "{0:f}" 長(zhǎng)日期,短時(shí)間。dddd,MMMM dd,yyyy HH:mm aa 如, Monday, January30, 2008 10:00am?
DataFormatString= "{0: D}" 長(zhǎng)日期。dddd,MMMM dd,yyyy 如: Monday,January 30,2008?
DataFormatString= "{0:F}" 長(zhǎng)日期,長(zhǎng)時(shí)間 dddd,MMMM dd,yyyy HH:mm:ss aa?
DataFormatString= "{0: s}" ISO 標(biāo)準(zhǔn)時(shí)間。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?
-----------------------------------------------------------------
格式字符串 輸入 結(jié)果?
"{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?
常用的日期時(shí)間格式:?
格式 說(shuō)明 輸出格式?
d 精簡(jiǎn)日期格式 MM/dd/yyyy?
D 詳細(xì)日期格式 dddd, MMMM dd, yyyy?
f 完整格式 (long date + short time) dddd, MMMM dd, yyyy HH:mm?
F?
完整日期時(shí)間格式?
(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 適中日期時(shí)間格式 yyyy-MM-dd HH:mm:ss?
t 精簡(jiǎn)時(shí)間格式 HH:mm?
T 詳細(xì)時(shí)間格式 HH:mm:ss
?
<%#?? String.Format("{0:yyyy-MM-dd} ", Eval("EffectiveDate "))%>
<%#?? String.Format("{0:yyyy-M-d} ", DataBinder.Eval(Container.DataItem, "EffectiveDate "))%>
轉(zhuǎn)載于:https://www.cnblogs.com/hitler/p/3816646.html
總結(jié)
以上是生活随笔為你收集整理的DataFormatString 转的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 可以像微信钱包一样?2020年数字钱包技
- 下一篇: 文储研习社第11期 | DAO的前世今生