how to use dateadd to add 1 day + 10 minutes

Hi!

This is the query i have!  it works fine but i want to edit it a little!
As you can see it now adds 1 day to  "on_date_time". i need it to add 1 day + 10 minutes??
Any Ideas ?

Insert into ttsessions
    (mobile_id,cust_id,on_date_time,off_date_time,[length],approved,burntime,complete,price,changed)
Select
     mobile_id,cust_id,dateadd(d,+1,convert(char(8),on_date_time,112)),off_date_time,length],approved,burntime,complete,price,
changed

 from #temp

/J
jamppiAsked:
Who is Participating?
 
Lee SavidgeCommented:
Ahh, right ok. Try this.

Lee
Insert into ttsessions
    (mobile_id,cust_id,on_date_time,off_date_time,[length],approved,burntime,complete,price,changed)
Select
     mobile_id,cust_id,dateadd(minute, 10, convert(datetime, convert(nvarchar(10), on_date_time + 1, 112), 112)),off_date_time,length],approved,burntime,complete,price,
changed

 from #temp

Open in new window

0
 
Lee SavidgeCommented:
select dateadd(minute, 1450, getdate())

Lee
0
 
RiteshShahCommented:
declare @dt datetime
set @dt='10/10/10'
select @dt,DATEADD(day,1,@dt) as dayAdd,DATEADD(minute,10,@dt) MinAdd,dateadd(minute,10,DATEADD(day,1,@dt)) as dayandMinAdd
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Lee SavidgeCommented:
To be specific, try this.

Lee
Insert into ttsessions
    (mobile_id,cust_id,on_date_time,off_date_time,[length],approved,burntime,complete,price,changed)
Select
     mobile_id,cust_id,dateadd(minue,1450,convert(char(8),on_date_time,112)),off_date_time,length],approved,burntime,complete,price,
changed

 from #temp

Open in new window

0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
How many minutes are in a day?  1440.  Add 1450 minutes and you add 1 day + 10 minutes.  I don't recall the specific value in SQL, but in vbscript it would be "n" for miNutes
0
 
Lee SavidgeCommented:
Typo.

Lee
Insert into ttsessions
    (mobile_id,cust_id,on_date_time,off_date_time,[length],approved,burntime,complete,price,changed)
Select
     mobile_id,cust_id,dateadd(minute,1450,convert(char(8),on_date_time,112)),off_date_time,length],approved,burntime,complete,price,
changed

 from #temp

Open in new window

0
 
jamppiAuthor Commented:
Hi!  

maybe i need to clarify a little!

now the query inserts 1 day!
 
if on_date_time is   for example 2010-04-15 12:12:12  it needs to set to  2010-04-16 00:10:00.

meaning.. Jump to next day midnight and add 10 minutes

adding 1450 minutes will be wrong!

/j
0
 
jamppiAuthor Commented:
Thank you, Perfect!
0
 
Lee SavidgeCommented:
Glad to help.

Lee
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.