SSRS date time expressions

Below are SSRS expressions which are used for date operations:

-       If we want to show date parameters on SSRS report for start date and end date and we want to show default value for start date as current month’s start date and for End date parameter it should be end date of current month, use below expressions:

Start Date Parameter, Default value expression

=DateSerial(Year(Now()), Month(Now()), “1”).AddMonths(-1)

End Date Parameter, Default value expression

=DateSerial(Year(Now()), Month(Now()), “1”).AddDays(-1)

-       First Day of Current Month:

=DateAdd("d",-(Day(today)-1), Today)

-        Last Day of Current Month:


-        First Day of Last Month:


-        Last Day of Last Month:


-        First day of next month:


     -        First Day of Current Year:


-        Last Day of Current Year:

=DateSerial(Year(Now()), 12, 31)

-        First day of next year:


-        Last Day of Last Year:

            =dateadd(DateInterval.Year,-1,DateSerial(Year(Now()), 12, 31))

      -        Format Data value:

              =Format(Parameters!Date.Value,"dd-MM-yyyy") --- 21-02-2016

              =Format(Parameters!Date.Value,"dd/MM/yyyy") --- 21/02/2016

              =Format(Parameters!Date.Value,"MMM-dd-yyyy") --- Feb-21-2016

              =Format(Parameters!Date.Value,"MMM-dd-yy") --- Feb-21-16

=MonthName(Month(DateAdd("M",-1,Parameters!AsOfDate.Value)))& "  "& (Year(DateAdd("Y",-1,Parameters!AsOfDate.Value))) ---September 2010

-        Monday of current week

=DateAdd(“d”, 2 – DatePart(“w”,Today) , Today)

=Today.AddDays(1- Today.DayOfWeek)

-        Friday current week

=DateAdd(“d”, 6 – DatePart(“w”,Today) , Today)

=Today.AddDays(5- Today.DayOfWeek)

-        End of this week

=DateAdd(“d”, 8 – Weekday(Today), Today).ToString(“dd/MM/yyyy”)

-        Start of the week (2 weeks ago)

=DateAdd(“d”, -(Weekday(Today)+12) , Today).ToString(“dd/MM/yyyy”)

-        Return Current Month Name


For more SSRS datetime expression, go through on below page:
Date Time Functions of SSRS expressions

FB Fun4You: New Funny Prank Compilation


No comments:

Post a Comment