SSRS:weekOfYear

时间:2016-02-12 08:54:33

标签: sql reporting-services

我的x轴有这个表达式:

="W" & DatePart(DateInterval.WeekOfYear, Fields!Date.Value)

由于闰年,我想在2016年减去1 我可以在这里做这样的事情:

="W" & iif(DatePart(DateInterval.WeekOfYear = "2015", Fields!Date.Value, iif(DatePart(DateInterval.WeekOfYear = "2016", Fields!Date.Value)-1,) Fields!Date.Value))

我在报告中尝试使用此代码:

Function getWeekNumber(ByVal d As DateTime) As Integer
    dim culture as System.Globalization.CultureInfo
    culture = system.Globalization.CultureInfo.CurrentCulture

    dim weekRule as System.Globalization.CalendarWeekRule
    weekRule = culture.DateTimeFormat.CalendarWeekRule

    dim firstDayOfWeek as System.DayOfWeek
    firstDayOfWeek = culture.DateTimeFormat.FirstDayOfWeek

    return culture.Calendar.GetWeekOfYear(d, weekRule, firstDayOfWeek)
End Function

但是这显示我不是正确的周数,数据库不是来自欧洲,我没有可能在数据库中更改某些内容。我怎样才能转换周数?

0 个答案:

没有答案