added cast function for timestamp type