zoukankan      html  css  js  c++  java
  • GridView和DataFormatString

    如果DataFormatString无效,请添加属性 HtmlEncode = "false"

    ---------------------------------------

    设定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

     

    -------长沙程序员技术交流QQ群:428755207-------
  • 相关阅读:
    ORACLE通过netca配置监听遇到 TNS04415错误
    图说计算机编程简史
    关于在VS2008以下版本的MFC程序使用VS 2008 FeaturePack出现内存泄露的理解
    对话框的OnPaint函数的两种写法的区别
    Hibernate 3.6.0 Beta1
    Hibernate 3.6.0 Beta1
    Maven 与 Checkstyle
    NetBeans 时事通讯(刊号 # 110 Jul 21, 2010)
    NetBeans 时事通讯(刊号 # 111 Jul 28, 2010)
    教育哲学的碰撞
  • 原文地址:https://www.cnblogs.com/qq4004229/p/1908033.html
Copyright © 2011-2022 走看看