How do I add months to a CURRENT_TIMESTAMP in SQL?

后端 未结 3 1005
生来不讨喜
生来不讨喜 2021-01-01 16:35

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.

3条回答
  •  一生所求
    2021-01-01 17:12

    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.

提交回复
热议问题