September 13, 2010 at 9:24 am
I apologize for how basic this question is but I've googled it with no success. I want to put the current date on my report so that when people run it and print it out, there is a date stamped on it.
I've used =Today() as the expression but that actually produces 9/13/2010 12:00:00AM
How do I get rid of the 12:00:00AM.
Thanks so much for your help.
September 13, 2010 at 10:07 am
You could try =format(now(), "dd MMM yyyy")
September 13, 2010 at 11:02 am
First returns just the date
declare @date Char(10)
set @date = convert(char(10),getdate(),101)
SELECT @DAte
This will return the date with a time of midnight
DECLARE @midnight DATETIME
SELECT @midnight = DATEADD(dd,0,DATEDIFF(dd,0,getdate()))
SELECT @midnight
Look at this and add to your toolbox
https://www.sqlservercentral.com/blogs/lynnpettis/archive/2009/03/25/some-common-date-routines.aspx
September 13, 2010 at 1:10 pm
Fishbarnriots (9/13/2010)
You could try =format(now(), "dd MMM yyyy")
Fishbarriots - had skepticism about how easy your answer looked but what do you know - it works!!! 😀
Thank you so much!
September 13, 2010 at 1:22 pm
In SSRS I usually use something like
=FormatDateTime(Today(),DateFormat.LongDate)
or
=FormatDateTime(Today(),DateFormat.ShortDate)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply