Calculate elapse period in Teradata

A nice feature of a DBMS is to be able to calculate elapse period. Important questions like “how many days to go to pension?’, can be addressed. In teradata, this looks like:

select cast(1231125 as date) - current_date;

This little sentence involves a typecasting from an integer to a date. The integer is 1221125 that stands for 1900+123 = 2023 as the year in which pension will start, 11 as the month and 25 as the day. So cast(1231125) leads to 25 November, 2023. The current date is now. The difference is the number of days before retirement. In this case 766 days.

Door tom