输入类型DateTime - 数值格式? [英] Input type DateTime - Value format?

查看:416
本文介绍了输入类型DateTime - 数值格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用哪种格式的日期和时间,以用于 datetime 类型的HTML5输入元素?



我曾尝试过:


  • 1338575502

  • 01/06/2012 19:31

  • 01/06/2012 19:21 :00

  • 2012-06-01

  • 2012-06-01 19:31

  • 2012-06-01 19:31:00

    没有一个可以工作。

    解决方案
    $


    表示全局日期和时间的字符串。


    $ b $ p 价值:[RFC 3339]中定义的有效日期时间
    ,具有以下附加条件:



    •日期/时间语法中的字母T和Z必须始终为大写字母

    •日期全部生成而是定义为四位或
    多位数字,表示大于0的数字。 b $ b

    1990-12-31T23:59:60Z

    1996-12-19T16:39:57-08:00

    http://www.w3.org/TR/html-markup/input.datetime.html#input.datetime.attrs.value



    更新:


    此功能已过时。虽然它可能在某些浏览器中仍然有效,但它的使用是不鼓励的,因为它可以在任何时候被删除。尝试使用
    避免使用它。



    HTML是输入日期和
    时间(小时,分钟,秒和小数部分)的控件一秒)以及
    时区。此功能已从WHATWG HTML中移除,浏览器不再支持

    b使用)日期时间本地输入类型。



    https:/ /developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime


    In which format should I put the date and time, for use in the HTML5 input element with datetime type?

    I have tried:

    • 1338575502
    • 01/06/2012 19:31
    • 01/06/2012 19:21:00
    • 2012-06-01
    • 2012-06-01 19:31
    • 2012-06-01 19:31:00

    None of them seem to work.

    解决方案

    For <input type="datetime" value="" ...

    A string representing a global date and time.

    Value: A valid date-time as defined in [RFC 3339], with these additional qualifications:

    •the literal letters T and Z in the date/time syntax must always be uppercase

    •the date-fullyear production is instead defined as four or more digits representing a number greater than 0

    Examples:

    1990-12-31T23:59:60Z

    1996-12-19T16:39:57-08:00

    http://www.w3.org/TR/html-markup/input.datetime.html#input.datetime.attrs.value

    Update:

    This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

    The HTML was a control for entering a date and time (hour, minute, second, and fraction of a second) as well as a timezone. This feature has been removed from WHATWG HTML, and is no longer supported in browsers.

    Instead, browsers are implementing (and developers are encouraged to use) the datetime-local input type.

    Why is HTML5 input type datetime removed from browsers already supporting it?

    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime

    这篇关于输入类型DateTime - 数值格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆