Moved datetime helpers from controller.