Configure your Calendar
to use a different Locale
.
Calendar
s translate the encoded time into the local time. Those 20+ seconds just don't exist with different display formats in that Locale
, so if you insist on keeping that Locale
, and you insist on displaying dates with seconds set so, then you need to take it up with the Dutch government in 1937; however, if you change the display formatting to that of a different Locale
, you will discover that the actual value of the underlying time data structure wasn't changed, it will resolve to different times in locales that have different seconds values to display.
The only caveats is that should you manipulate the time between reading it and storing it, then you might inadvertently create a new Time
or Calendar
object, which would set or reset its underlying data structures based on a translation of the Locale
formatted time into the underlying data representation.
This is why it is best to handle bulk date and time handling in UTC, without daylight savings. Even though the times don't match up to the local times (and are harder to read for people in different time zones), every second of UTC exists, so simple +5 second changes can quickly be verified by a simple formatting of the impacted time.
The only caveat with this sort of handling is that later, you must always translate UTC time back to local time for display. Depending on the education of your audience, some of the Dutch might be shocked to find that their government didn't allow such seconds to exist and might demand that they are shown despite the rulings that such seconds are not part of the Dutch calendar.
Just wait until you discover the missing days back in 1582.