implemented util for get time validity