DateTime
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
JSON 表示法 |
{
"date": string
} |
字段 |
date |
string
ISO 8601 扩展格式的日期/时间。可能需要偏移量,也可能不需要(请参阅父字段的文档)。时间最高可指定到纳秒级精度。偏移量可指定到秒级精度(虽然 ISO 8601 中未以秒为精度指定偏移量)。 例如: 1985-04-12T23:20:50.52Z 表示世界协调时间 (UTC) 1985 年 4 月 12 日 23 时 20 分 50.52 秒。
1985-04-12T19:20:50.52-04:00 表示比世界协调时间 (UTC) 早 4 个小时的 1985 年 4 月 12 日 19 时 20 分 50.52 秒(与上述示例的时间相同)。如果指定日期/时间对应的是纽约的实际位置,则此时间等同于美国东部夏令时间 (EDT)。请注意,在采用夏令时的地区,偏移量会有所不同,具体取决于一年中的不同时间。
1985-04-12T19:20:50.52 表示不带偏移量信息的 1985 年 4 月 12 日 19 时 20 分 50.52 秒。
提供偏移量后,地球上发生的这个时间绝对是即时的。日期/时间将根据用户的时区进行调整。例如,对于纽约的用户,2018-06-19T18:30:00-04:00 时间为 18:30:00,对于洛杉矶的用户,时间为 15:30:00。 如果省略偏移值,则该值为本地日期/时间,代表世界各地的多个时刻。日期/时间将始终采用用户当前的时区。例如,对于纽约的用户,2018-06-19T18:30:00 时间为 18:30:00,对于洛杉矶的用户,同样为 18:30:00。当相同的当地日期/时间应用于多个时区的多个实际位置时,这会非常有用。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThe JSON schema represents a date object.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edate\u003c/code\u003e field is a string that adheres to the ISO 8601 extended format for date and time.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edate\u003c/code\u003e field can include an offset to specify the time zone, or it can be omitted for local time representation.\u003c/p\u003e\n"],["\u003cp\u003eProviding an offset ensures the \u003ccode\u003edate\u003c/code\u003e represents a specific instant in time globally, while omitting it makes it a local time subject to user time zones.\u003c/p\u003e\n"]]],["The core information defines the `date` field within a JSON structure. The `date` is a string representing an ISO 8601 date/time, with optional offset information. It may include nanosecond precision. Providing an offset creates an absolute instant in time, adjusted to the user's timezone. Omitting the offset creates a local date/time, consistent across time zones. This format can represent times down to the nanosecond and offsets with second precision.\n"],null,["# DateTime\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\n| JSON representation |\n|----------------------------|\n| ``` { \"date\": string } ``` |\n\n| Fields ||\n|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `date` | `string` An ISO 8601 extended format date/time. Offset may or may not be required (refer to the parent field's documentation). Time may be specified up to nanosecond precision. Offsets may be specified with seconds precision (even though offset seconds is not part of ISO 8601). For example: `1985-04-12T23:20:50.52Z` would be 20 minutes and 50.52 seconds after the 23rd hour of April 12th, 1985 in UTC. `1985-04-12T19:20:50.52-04:00` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985, 4 hours before UTC (same instant in time as the above example). If the date/time is intended for a physical location in New York, this would be the equivalent of Eastern Daylight Time (EDT). Remember that offset varies in regions that observe Daylight Saving Time (or Summer Time), depending on the time of the year. `1985-04-12T19:20:50.52` would be 20 minutes and 50.52 seconds after the 19th hour of April 12th, 1985 with no offset information. Providing an offset makes this an absolute instant in time around the world. The date/time will be adjusted based on the user's time zone. For example, a time of `2018-06-19T18:30:00-04:00` will be 18:30:00 for a user in New York and 15:30:00 for a user in Los Angeles. Omitting the offset makes this a local date/time, representing several instants in time around the world. The date/time will always be in the user's current time zone. For example, a time of `2018-06-19T18:30:00` will be 18:30:00 for a user in New York and also 18:30:00 for a user in Los Angeles. This is useful when the same local date/time should apply to many physical locations across several time zones. |"]]