datetime helper refactoring