I have used the LAST_DAY() function in Oracle like this:
Last_Day( to_date( '$pay_first_day' , 'YYYY-mm-dd') )
What do i have to do in SQL server 2008 R2 database to achieve the same result?
Try this one -
DECLARE @Date DATETIME
SELECT @Date = GETDATE()
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @Date) + 1, 0) - 1
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