Configure Calendar to use a different Locale .
Calendar translate the encoded time to local time. These 20+ seconds simply do not exist with different display formats in this Locale , so if you insist on keeping this Locale , and insist on displaying the dates with the set seconds, then you need to take it with you the Dutch government in 1937; however, if you change the display formatting to another Locale , you will find that the actual value of the base time data structure has not been changed, it will be resolved to different times in locales that have different seconds for the display.
The only caveat is that you have to manipulate the time between reading and storage, then you can inadvertently create a new Time or Calendar object that would set or reset its basic data structures based on translating the formatted Locale time into a basic data representation.
This is why it is best to handle date and time processing in UTC, without daylight saving time. Despite the fact that the time does not correspond to local times (and it is harder to read for people in different time zones), every second of UTC exists, so simple +5 second changes can be quickly checked by simply formatting the impact of time.
The only caveat associated with this type of processing is that later on you should always translate UTC time back to local time for display. Depending on the education of your audience, some of the Dutch may be shocked to find that their government has not allowed such seconds to exist and may require them to be shown, even though such seconds are not part of the Dutch calendar.
Wait until you find the missing days in 1582.
Edwin buck
source share