Eval() 的常用格式2

((string)DataBinder.Eval(Container, "DataItem.P_SHIP_TIME_SBM8")).Substring(4,4)
{0:d} 日期只显示年月日
{0:yyyy-mm-dd} 按格式显示年月日
{0:c} 货币样式
<% #Container.DataItem( " price " , " {0:¥#,##0.00} " ) %>
<% # DataBinder.Eval(Container.DataItem, " Company_Ureg_Date " , " {0:yyyy-M-d} " ) %>


Specifier Type      Format    Output (Passed Double 1.42)   Output (Passed Int -12400)
c   Currency         {0:c}      $1.42      -$12,400
d   Decimal          {0:d}     System.FormatException   -12400
e   Scientific       {0:e}     1.420000e+000     -1.240000e+004
f   Fixed point      {0:f}   1.42     -12400.00
g   General          {0:g}   1.42      -12400
n   Number with commas for thousands   {0:n}   1.42      -12,400
r   Round trippable     {0:r}   1.42      System.FormatException
x   Hexadecimal     {0:x4}   System.FormatException    cf90


{0:d} 日期只显示年月日
{0:yyyy-mm-dd} 按格式显示年月日


样式取决于 Web.config 中的设置

{0:c}   或 {0:£0,000.00} 货币样式   标准英国货币样式
< system .web >
      
< globalization requestEncoding ="utf-8" responseEncoding ="utf-8" culture ="en-US" uiCulture ="en-US" />
</ system.web >
显示为 £3,000.10

{0:c}   或 string.Format("{0:C}", price); 中国货币样式
< system .web >
      
< globalization requestEncoding ="utf-8" responseEncoding ="utf-8" culture ="zh-cn" uiCulture ="zh-cn" />
</ system.web >
显示为 ¥3,000.10

{0:c}   或 string.Format("{0:C}", price); 美国货币样式
< system .web >
      
< globalization requestEncoding ="utf-8" responseEncoding ="utf-8" />
</ system.web >
显示为 $3,000.10

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值