now.dateadd(d, -1) at 7AM

  • Hi all... I am trying to add a default date parameter in my report where the start date is yesterday @ 7AM. Can anyone help me with this?

    I get the whole day piece, but how do I add a specific time?

  • Are you using reporting services or T-SQL code?

    For T-SQL, you can use this formula:

    DATEADD(hour, 7, DATEADD( Day, DATEDIFF(day, 0, GETDATE())-1,0))

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thank you. I am actually using reporting services

  • Hi

    Try this:

    =DateAdd(DateInterval.Hour,7,DateAdd(DateInterval.Day,-1,today()))

    Br.

    Mike

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply