Changing variable type to datetime