开发者

Convert day number to date of this year in Reporting Services

In my dataset, values are returned grouped by a daynumber (sql: datepart(day, xx)). In SSRS (2005), I want to convert this integer back to a date value. Eg 1 becomes 1/01/2010, 32 becomes 开发者_开发知识库1/02/2010. I've already looked into the date/time functions of SSRS but don't seem to find any function that does the trick. Can anyone help me? Thank you!


You need to use the dateadd function, to add the daynumber (minus 1) from your query (as a number of days) to the first of January of the relevant year - eg:

=DateAdd("d",Fields!DayNumber-1,DateValue("01-JAN-2010"))


My query now returns numbers from 0 to 10 referring to the day, so 0 is today, 1 is tomorrow. I need to do this because of fixed columns in SSRS but in the header of the columns, I want to display the according date. This can be done doing a dateadd of this value with Today(). Thanks anyway, but I've already worked around my issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜