refactored date formatting