Fix bug of date time calculation