DateTime
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Biểu diễn dưới dạng JSON |
{
"date": string
} |
Trường |
date |
string
Ngày/giờ ở định dạng mở rộng ISO 8601. Mức chênh lệch có thể là hoặc không bắt buộc (tham khảo tài liệu của trường mẹ). Thời gian có thể được chỉ định với độ chính xác lên đến nano giây. Có thể chỉ định giá trị chênh lệch với độ chính xác theo giây (mặc dù giây bù trừ không phải là một phần của ISO 8601). Ví dụ: 1985-04-12T23:20:50.52Z sẽ là 20 phút 50, 52 giây sau giờ thứ 23 của ngày 12 tháng 4 năm 1985 theo giờ UTC.
1985-04-12T19:20:50.52-04:00 sẽ là 20 phút 50, 52 giây sau giờ thứ 19 của ngày 12 tháng 4 năm 1985, 4 giờ trước giờ UTC (cùng thời gian như ví dụ trên). Nếu ngày/giờ dành cho một vị trí thực tế tại New York, thì ngày/giờ này sẽ tương đương với Giờ ban ngày miền Đông (EDT). Xin lưu ý rằng mức chênh lệch sẽ thay đổi tuỳ theo khu vực áp dụng Giờ tiết kiệm ánh sáng ngày (hay Giờ mùa hè), tuỳ thuộc vào thời gian trong năm.
1985-04-12T19:20:50.52 sẽ là 20 phút 50, 52 giây sau giờ thứ 19 của ngày 12 tháng 4 năm 1985 mà không có thông tin về chênh lệch.
Việc cung cấp giá trị bù trừ sẽ giúp việc này xảy ra ngay lập tức trên toàn thế giới. Ngày/giờ sẽ được điều chỉnh dựa trên múi giờ của người dùng. Ví dụ: thời gian của 2018-06-19T18:30:00-04:00 sẽ là 18:30:00 đối với người dùng ở New York và 15:30:00 đối với người dùng ở Los Angeles. Việc bỏ qua độ lệch sẽ khiến đây là ngày/giờ địa phương, thể hiện một số thời điểm trong thời gian trên khắp thế giới. Ngày/giờ sẽ luôn theo múi giờ hiện tại của người dùng. Ví dụ: thời gian của 2018-06-19T18:30:00 sẽ là 18:30:00 đối với người dùng ở New York và cũng là 18:30:00 đối với người dùng ở Los Angeles. Điều này rất hữu ích khi cùng một ngày/giờ địa phương áp dụng cho nhiều vị trí thực tế trong nhiều múi giờ.
|
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\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. |"]]