refactored macro for date/time formatting