refactoring date to time