日期和ISO日期之间的差异

时间:2011-07-14 15:17:20

标签: javascript jquery

我刚刚遇到日期和ISO日期之间JavaScript差异的两个日期。有人能否说明这两者之间的区别是什么?

3 个答案:

答案 0 :(得分:7)

ISO代表国际标准化组织。 ISO标准组织数据,因此最大的时间术语(年份)首先出现在数据字符串中并进展到最小的术语。 EX:2011-07-14。

日期对象中的Javacript的getDate()函数返回月中的某一天(1-31)。 Javascript还有一些您可能想要使用的其他功能,例如:

var d = new Date();
d.getDay()
d.getFullYear()
d.getHours()
d.getMinutes()
d.getSeconds()

此处提供了良好的文档:http://www.w3schools.com/jsref/jsref_obj_date.asp

总而言之,ISO日期只是显示日期的常用格式。

答案 1 :(得分:5)

MDC文档中有关于Date Object的大量信息。

他们对如何生成iso-8601格式的日期有example

答案 2 :(得分:1)

我找到了一个在线计算器,用于计算两个日期时间戳之间的差异 http://www.onlineconversion.com/days_between_advanced.htm 其源代码

"@babel/preset-env": {
      "version": "7.8.3",
      "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.8.3.tgz",
      "integrity": "sha512-Rs4RPL2KjSLSE2mWAx5/iCH+GC1ikKdxPrhnRS6PfFVaiZeom22VFKN4X8ZthyN61kAaR05tfXTbCvatl9WIQg==",
      "dev": true,
      "requires": {
        "@babel/compat-data": "^7.8.0",
        "@babel/helper-compilation-targets": "^7.8.3",
        "@babel/helper-module-imports": "^7.8.3",
        "@babel/helper-plugin-utils": "^7.8.3",
        "@babel/plugin-proposal-async-generator-functions": "^7.8.3",
        "@babel/plugin-proposal-dynamic-import": "^7.8.3",
        "@babel/plugin-proposal-json-strings": "^7.8.3",
        "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
        "@babel/plugin-proposal-object-rest-spread": "^7.8.3",
        "@babel/plugin-proposal-optional-catch-binding": "^7.8.3",
        "@babel/plugin-proposal-optional-chaining": "^7.8.3",
        "@babel/plugin-proposal-unicode-property-regex": "^7.8.3",
        "@babel/plugin-syntax-async-generators": "^7.8.0",
        "@babel/plugin-syntax-dynamic-import": "^7.8.0",
        "@babel/plugin-syntax-json-strings": "^7.8.0",
        "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0",
        "@babel/plugin-syntax-object-rest-spread": "^7.8.0",
        "@babel/plugin-syntax-optional-catch-binding": "^7.8.0",
        "@babel/plugin-syntax-optional-chaining": "^7.8.0",
        "@babel/plugin-syntax-top-level-await": "^7.8.3",
        "@babel/plugin-transform-arrow-functions": "^7.8.3",
        "@babel/plugin-transform-async-to-generator": "^7.8.3",
        "@babel/plugin-transform-block-scoped-functions": "^7.8.3",
        "@babel/plugin-transform-block-scoping": "^7.8.3",
        "@babel/plugin-transform-classes": "^7.8.3",
        "@babel/plugin-transform-computed-properties": "^7.8.3",
        "@babel/plugin-transform-destructuring": "^7.8.3",
        "@babel/plugin-transform-dotall-regex": "^7.8.3",
        "@babel/plugin-transform-duplicate-keys": "^7.8.3",
        "@babel/plugin-transform-exponentiation-operator": "^7.8.3",
        "@babel/plugin-transform-for-of": "^7.8.3",
        "@babel/plugin-transform-function-name": "^7.8.3",
        "@babel/plugin-transform-literals": "^7.8.3",
        "@babel/plugin-transform-member-expression-literals": "^7.8.3",
        "@babel/plugin-transform-modules-amd": "^7.8.3",
        "@babel/plugin-transform-modules-commonjs": "^7.8.3",
        "@babel/plugin-transform-modules-systemjs": "^7.8.3",
        "@babel/plugin-transform-modules-umd": "^7.8.3",
        "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3",
        "@babel/plugin-transform-new-target": "^7.8.3",
        "@babel/plugin-transform-object-super": "^7.8.3",
        "@babel/plugin-transform-parameters": "^7.8.3",
        "@babel/plugin-transform-property-literals": "^7.8.3",
        "@babel/plugin-transform-regenerator": "^7.8.3",
        "@babel/plugin-transform-reserved-words": "^7.8.3",
        "@babel/plugin-transform-shorthand-properties": "^7.8.3",
        "@babel/plugin-transform-spread": "^7.8.3",
        "@babel/plugin-transform-sticky-regex": "^7.8.3",
        "@babel/plugin-transform-template-literals": "^7.8.3",
        "@babel/plugin-transform-typeof-symbol": "^7.8.3",
        "@babel/plugin-transform-unicode-regex": "^7.8.3",
        "@babel/types": "^7.8.3",
        "browserslist": "^4.8.2",
        "core-js-compat": "^3.6.2",
        "invariant": "^2.2.2",
        "levenary": "^1.1.0",
        "semver": "^5.5.0"
      }
相关问题