June 30, 2016 at 7:20 am
Hi Friends. Need help for adding minutes in datetime colum.
Example, I am having column StarTime with datatype Datetime. For example below.
StartTime
1899-12-30 07:45:00.000
I want add 240 minutes int he above value and display that. How can i do that?
Thanks,
Abhas.
June 30, 2016 at 7:23 am
abhas (6/30/2016)
Hi Friends. Need help for adding minutes in datetime colum.Example, I am having column StarTime with datatype Datetime. For example below.
StartTime
1899-12-30 07:45:00.000
I want add 240 minutes int he above value and display that. How can i do that?
Thanks,
Abhas.
suggest you research DATEADD
https://msdn.microsoft.com/en-GB/library/ms186819.aspx
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
June 30, 2016 at 8:30 am
here's a coded example.
create table #MyExample(Id int identity(1,1) not null primary key,StartTime datetime, OriginalValue varchar(30) )
INSERT INTO #MyExample(StartTime,OriginalValue)
SELECT '1899-12-30 07:45:00.000','1899-12-30 07:45:00.000'
SELECT DATEADD(minute,240,StartTime) As NewTime FROM #MyExample
UPDATE #MyExample
SET StartTime = DATEADD(minute,240,StartTime)
WHERE ID = 1
SELECT * FROM #MyExample
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy