Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

DateAdd() - how to add 5 hours and 25 minutes to a date? Expand / Collapse
Author
Message
Posted Friday, August 9, 2013 12:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 6, 2013 12:31 PM
Points: 2, Visits: 11
Hi there,

This is actually a question re how to do this in SSRS's Report Designer 1.0, please forgive me if this isn't the right site, but I'm close to losing the plot on this.

Basically, I have a date to which I need to add a time span consisting of multiple (what MS calls) dateparts. All of the sites / forums I've come across deal only with the syntax of one datepart, i.e. adding days OR hours OR minutes, etc.

I need to add hours AND minutes using DateAdd()... Appreciate any help!

Many thanks,
Jens
Post #1482885
Posted Friday, August 9, 2013 12:33 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:18 AM
Points: 1,404, Visits: 1,633
try something like this:

DATEADD(HOUR,5,DATEADD(MINUTE,25,"origdatetime"))

Post #1482892
Posted Friday, August 9, 2013 12:43 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 6, 2013 12:31 PM
Points: 2, Visits: 11
You did it, Batgirl! Thanks, I seriously owe you a beer, my weekend is now officially made.
Cheers,
Jens
Post #1482895
Posted Friday, August 9, 2013 12:46 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:18 AM
Points: 1,404, Visits: 1,633
Glad it worked - I will enjoy that beer!
Post #1482898
Posted Friday, August 9, 2013 12:54 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 12:39 AM
Points: 3,136, Visits: 11,494
This also works:

select
Curr_Datetime= getdate(),
[Curr_Datetime Plus 05:25] =getdate()+'05:25:00.000'

Results:
Curr_Datetime           Curr_Datetime Plus 05:25
----------------------- ------------------------
2013-08-09 14:52:58.457 2013-08-09 20:17:58.457



Post #1482901
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse