Nevertheless, personally, i would avoid above calculation as it is difficult to read and wrong for dates before 1900.
Here are some more useful Teradata Date Calculations:
All calculations above are using the EXTRACT function.
You definitely should avoid substrings for date calculations. Below are three alternative ways of calculating the first day of a month for any given date (based on a huge test table). As you can see, the consumed CPU Times are very different. While the INTEGER style calculation (the second table row) consumes the least resources, you might prefer to avoid it because of its bad readability.
|114,40||thedate – EXTRACT(DAY FROM thedate ) + 1|
|74,10||thedate / 100 * 100 + 1 (DATE)|
|166,50||thedate – SUBSTRING(thedate FROM 1 FOR 8) || ’01’ (DATE)|