I need help with dates in SQL Server.
I have a date field and would like to know if this date is odd or even. I need to make this comparison to use in another field. I looked for some methods but I did not get the solution. I thought about using DATEDIFF but I have no other date field to compare.
CASE WHEN DATEPART(DW, CONVERT(DATE,data_saida)) IN (3) AND porto = 409
THEN CONVERT(VARCHAR(15),DATEADD(DAY, -2, CONVERT(DATE,data_saida))) + ' TO ' + CONVERT(VARCHAR(15),DATEADD(DAY, -1, CONVERT(DATE, data_saida)))
This code I use this delivery is only on Tuesday. I am not considering whether output_data is odd or even. Now this last-minute demand has come and I do not know where to fit it right.