Technical Article

LastDayPreviousMonth / FirstDayCurrentMonth

,

The fastest way of getting
LastDayPreviousMonth / FirstDayCurrentMonth

SELECT DATEADD(dd, CAST(DATEDIFF(DAY,'17530101',CURRENT_TIMESTAMP) AS int)
                  - DAY(CURRENT_TIMESTAMP), '17530101') 
as LastDayPreviousMonth

SELECT DATEADD(dd, CAST(DATEDIFF(DAY,'17530101',CURRENT_TIMESTAMP) AS int)
                  - DAY(CURRENT_TIMESTAMP) + 1, '17530101') 
as FirstDayCurrentMonth

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating