visual studio 2010 - SSRS Add Months in current date with last day of month -
i want add months last day in current date using
=dateadd(dateinterval.month, +4, dateadd("d",-(day(today)), today))
expression.
output is
current_date = 12/02/2014
finish_date = 03/30/2014
the problem finsih_date month 03(march) , last day of march 31 parameter showing 30.
it may like:
=dateadd("d", -1, dateserial(datepart("yyyy", finish_date), datepart("m", dateadd("m", 1, finish_date)), 1))
for every day in given month calculates last day of given month. 03/30/2014 03/31/2014.
calculation works like: build new date set first day of following month of given date. substract 1 day. last day of month before. added 1 month last day of month of given date.
edit
code finished_date = today + 4 month (finished_date + 1 today + 5)
=dateadd("d", -1, dateserial(datepart("yyyy", dateadd("m", 5, today())), datepart("m", dateadd("m", 5, today())), 1))
Comments
Post a Comment