How do I get the last day on the month using SQL Reporting Services

后端 未结 7 994
花落未央
花落未央 2020-12-13 04:44

In SQL Server Reporting Services, how would I calculate the last day of the current month?

7条回答
  •  醉酒成梦
    2020-12-13 05:34

    There is an even easier way as in the marked answer:

    =DateSerial(Year(Now()), Month(Now())+1, 0)

    Since DateSerial() accepts integers as parameters one does not have to use AddMonths() and AddDays(). As in the example an instant calculation inside DateSerial() is possible.

    Furthermore day 1 is the first day of the month while the first day minus one day is the last day of the month before (1-1=0). So the example will return the date of the last day of the current month.

提交回复
热议问题