MickeyMin
asked on
Getting Current Monthend
Hi all,
Does anyone know how to calculate current monthend date from a date..
so 29-04-2008
returns
30-04-2008
Thanks!
Micky
Does anyone know how to calculate current monthend date from a date..
so 29-04-2008
returns
30-04-2008
Thanks!
Micky
ASKER
sorry but I think my date is a string '20080429'
ASKER
if I just run this part select dateadd(day, -1,dateadd(month, 1,'20080429'))
it returns
2008-05-28
it returns
2008-05-28
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
note: if you want to get a "date range" query to include up to the last day of the month, it should best be something like this, doing a < of the first of next month:
select ...
where yourfield < dateadd(month, 1,convert(datetime,left('20080429',6) + '01',112))
ASKER
thank you!
Open in new window