How can I add months to the CURRENT_TIMESTAMP in SQL Server?
The solution probably lies in DATEADD() but this works with a date only, not a datetime.
Thanks.
The Current_Timestamp is the ansi equivalent of GetDate() in SQL, so it is perfetly acceptable to use within a DateAdd function.
select dateadd(m,3,current_timestamp)
Adds 3 months to the current timestamp.
This works perfectly fine
SELECT DATEADD(month,1,CURRENT_TIMESTAMP)
From DATEADD (Transact-SQL)
date
Is an expression that can be resolved to a time, date, smalldatetime, datetime, datetime2, or datetimeoffset value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With