views:

833

answers:

5

I'm trying to populate an expression (default value of a parameter) with an explicit time. How do I remove the time from the the "now" function?

+3  A: 

Something like this:

=FormatDateTime(Now, DateFormat.ShortDate)

Michael Maddox
+1  A: 

Found the solution on http://ssrslearningcurve.wordpress.com/2008/08/08/using-the-dateadd-function-in-ssrs/

This gets the last second of the previous day:

DateAdd("s",-1,DateAdd("d",1,Today())

This returns the last second of the previous week: =dateadd("d", -Weekday(Now), (DateAdd("s",-1,DateAdd("d",1,Today()))))

Jeff
I stumbled here from google.. but.. this doesn't answer your question. (why do you care about the last second?) However, you did beat RSolberg (who correctly answered it). Maybe you should edit your accepted answer to reference his correct answer?
itchi
+4  A: 

Since SSRS utilizes VB, you can do the following:

=Today() 'returns date only

If you were to use:

=Now() 'returns date and current timestamp
RSolberg
+1  A: 

In the format property of any textbox field you can use format strings:

e.g. D/M/Y, D, etc.

Zaid Zawaideh
+2  A: 

=CDate(Now).ToString("dd/MM/yyyy")

Although you are hardcoding the date formart to a locale.

Perhentian
+1 for the concise answer that, as a matter of fact, was very helpful to me.
jasonco