Description
Use case:
I am working with timeseries data coming from
- sensors of all sorts of types and vendors
- business files (e.g. Excel exports in all kind of localizations and formats)
- output from other systems in all sorts of formats.
From my experience the amount of variations is almost unlimited. Be it the separators (or sometimes the lack of), the order of the elements and also the potential absence of some parts (optionally millisecond fractions, optionally offsets minutes, ...). The requirement goes way beyond what you can usually represent as a string pattern with describing string like ("yyyy-MM-dd") which are fairly unreadable as well if you think about the amount of variables for non-standard-stuff (fractions, timezone hour, timezone minute, ...)
Reference solution:
Coming from Java, all of these formats can be easily represented using a DateTimeFormatter
and described using a DateTimeFormatterBuilder
. The DateTimeFormatter offers a lot of predefined ISO formats as well.
Side note: The DateTimeFormatter can be used for printing instants as well.
Summary:
A comprehensive datetime library needs utilities to allow import and export of date/time strings in all formats for compatibility with the rest of the world.