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
It'd be nicer to have two overloads here, even though the implementation would be identical. It helps autocomplete and people exploring the API if we avoid Object in public APIs, I think.