Performing arithmetic that deliberately ignores DST.Įxample: in a day-planner UI, the visual height of a meeting may be the same even if DST skips or repeats an hour.These strings can also be parsed by Temporal.Instant, but to parse the local date and time then is required. Parsing local time from ISO 8601 strings like T16:08-08:00 that have a numeric offset without an IANA time zone like America/Los_Angeles.a sleep tracking device that only cares about the local time you went to sleep and woke up, regardless of where in the world you are. Modeling events that happen at the same local time in every time zone.įor example, the British Commonwealth observes a two minute silence every November 11th at 11:00AM in local time. Passing data to/from a component that is unaware of time zones, e.g.Interacting with poorly-designed legacy systems that record data in the server's non-UTC time zone.stock exchange data that is always America/New_York When the time zone is stored separately in a separate database column or a per-user setting.In this case, Temporal.PlainDateTime is an intermediate step before converting to/from Temporal.ZonedDateTime or Temporal.Instant using the separate time zone. Representing timezone-specific events where the time zone is not stored together with the date/time data.Temporal.PlainDate, Temporal.PlainTime, Temporal.PlainYearMonth, and Temporal.PlainMonthDay all carry less information and should be used when complete information is not required.Ī Temporal.PlainDateTime can be converted into any of the types mentioned above using conversion methods like toZonedDateTime or toPlainDate.īecause Temporal.PlainDateTime does not represent an exact point in time, most date/time use cases are better handled using exact time types like Temporal.ZonedDateTime and Temporal.Instant.īut there are cases where Temporal.PlainDateTime is the correct type to use: Do try it and report bugs don't use it in production!Ī Temporal.PlainDateTime represents a calendar date and wall-clock time, with a precision in nanoseconds, and without any time zone.įor use cases that require a time zone, especially using arithmetic or other derived values, consider using Temporal.ZonedDateTime instead because that type automatically adjusts for Daylight Saving Time.Ī Temporal.PlainDateTime can be converted to a Temporal.ZonedDateTime using a Temporal.TimeZone.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |