Working with date and time

When we work with dates we must take care of some points: 
  • Formatting of the date when saving it persistently (which should preferably be done with a universal standardization so that this date can be converted to the different types of formatting in the countries);
  • Formatting the date when displaying it to the user (which must be done according to the date format of the user's default location);
  • Dealing with the possible change of time zone;
  • Dealing with changes in the local time format by the user;
  • Dealing with the incorrect local time.
For the first point, we have a universal standard for date called Coordinated Universal Time (or UTC). An example of UTC format is 2020-11-10T16:22:09Z.
For the second point, we can pass the application context for a DateFormat object that will format the date in a form according to the context's locale.