Define a cast function from day_interval to int