Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reporting Services Remove Time from DateTime in Expression

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?

like image 222
Jeff Avatar asked Sep 08 '09 18:09

Jeff


People also ask

How to remove time from date parameter in SSrs?

Click the Design tab, right-click the textbox where you will display the @Time parameter, select expression. Clear the expression dialog box, then type in: =FormatDateTime(Parameters! Timer.

How do I display only the date in SSRS?

Right click - properties on the cell, select format, click the ellipsis "...", and you can see the date formats from there. This will be converted into a date code when you OK the dialog. This is useful as it sets the date in the fomat the user wants to see it in.

What is CDate in SSRS?

The CDate function converts the value to a date. The Now function returns a date value containing the current date and time according to your system. DateDiff returns a Long value specifying the number of time intervals between two Date values.


2 Answers

Something like this:

=FormatDateTime(Now, DateFormat.ShortDate)  

Where "Now" can be replaced by the name of the date/time field that you're trying to convert.)
For instance,

=FormatDateTime(Fields!StartDate.Value, DateFormat.ShortDate) 
like image 166
Michael Maddox Avatar answered Sep 23 '22 11:09

Michael Maddox


Since SSRS utilizes VB, you can do the following:

=Today() 'returns date only 

If you were to use:

=Now() 'returns date and current timestamp 
like image 35
RSolberg Avatar answered Sep 24 '22 11:09

RSolberg