Fix formatting dates at several places.

Common mistakes:
- DateFormats are not thread safe
- new Date() is used for formatting which does not specify a locale