Small refactoring of the code handling the conversion between strings and dates.
Initial import.