Current Date on Report

  • 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.

  • You could try =format(now(), "dd MMM yyyy")

  • 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

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • 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!

  • 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