time method to get time in correct format is written in index controller