Given Current_Date(), how can I get the dates for the second and fourth Friday of the previous month in Teradata?
E.g., if current_date is '2025-03-25' then the dates for the second and fourth Friday will be '2025-02-14' and '2025-02-28' respectively.
TIA
Given Current_Date(), how can I get the dates for the second and fourth Friday of the previous month in Teradata?
E.g., if current_date is '2025-03-25' then the dates for the second and fourth Friday will be '2025-02-14' and '2025-02-28' respectively.
TIA
Share Improve this question asked Mar 25 at 9:30 darkagedarkage 8693 gold badges14 silver badges23 bronze badges1 Answer
Reset to default 2There are lots of datetime functions in Teradata.
trunc(add_months(current_date,-1), 'MON'
returns the first of the previous month.
td_friday
returns the next friday >= a date.
Applying some math results in:
td_friday(trunc(add_months(current_date,-1), 'MON') + 13) as fri2,
td_friday(trunc(add_months(current_date,-1), 'MON') + 27) as fri4