SSRS - Set a parameter default date value to today at 6AM

Dear Experts:
I would like to set a date parameter default date value to today at 6AM.
e.g. 7/01/2018 6:00:00 AM
In other words I need the expression that can replace this expression that is not working:
=CDate(Format(Now(), "dd/MM/yyyy") + " 6 AM")


Note: I use SSRS 2016 and. I tried to run this report through the web service and fails with the invalid date error.
If I use expression =Today() then it works without any issue.
LVL 36
Miguel OzSoftware EngineerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Nitin SontakkeConnect With a Mentor DeveloperCommented:
Like several developers, I assume, you are confused between dates as understood by us humans and as understood by computers.

The best possible format to communicate dates with computers is yyyy-MM-dd HH:mm:ss.

Can you please modifying above as follows and give it a go?

=CDate(Format(Now(), "yyyy-MM-dd") + " 06:00:00")

On similar lines, you may also try format dd-MMM-yyyy HH:mm:ss

Hope it helps!
0
 
Miguel OzSoftware EngineerAuthor Commented:
Thank you it works OK, still the parameter format that comes out of the web service is US format but I can sort that issue out on the client side.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.