SQLTeam.com | Weblogs | Forums

Format param value to YYYYMMdd (20161031) instead of 10/31/2016 11.59.59 PM


#1

SSRS QUESTION
I have a parameter date_to that is formatting the the last date of each month in format example
10/31/2016 11.59.59 PM
however i want my date to be in format 20161031
I am using this expression in my parameter to get the last date of any month of any year
=DateSerial(Year)Now()), Month(Noe(), "1").AddMonths(1).AddDays(-1)


#2

Assuming your parameter is a type datetime

select convert(char(10), @yourparam, 112)

If this is coming from a dataset for your report, you can add it as a derived column in the select statement.


#3

You can use an expression like this:
=Format(Cdate(Fields!Date.Value),"yyyy-MM-dd")