I found a solution but I am not sure that is one of best solution?
Declare @.StartDate as datetime
Declare @.AddDate as datetime
Set @.AddDate = '1899-12-30 02:15:00.000'
Set @.StartDate = '2005-01-01 05:00'
Select @.StartDate as StartDate,
DateAdd(Minute, DatePart(Minute, @.AddDate), DateAdd(hour, DatePart(Hour,
@.AddDate), @.StartDate))
as FinishDate
Thanks MullerjannieThe most readable solution, in my opinion, is one of these choices:
SELECT @.StartDate + @.AddDate
SELECT @.StartDate + '2:15'
For this, @.AddDate should be set to '2:15'
The 1899 date will not work, since it represents two days
backwards from what you want.
Steve Kass
Drew University
Murat BUDAK wrote:
>I found a solution but I am not sure that is one of best solution?
>Declare @.StartDate as datetime
>Declare @.AddDate as datetime
>Set @.AddDate = '1899-12-30 02:15:00.000'
>Set @.StartDate = '2005-01-01 05:00'
>
>Select @.StartDate as StartDate,
> DateAdd(Minute, DatePart(Minute, @.AddDate), DateAdd(hour, DatePart(Hour,
>@.AddDate), @.StartDate))
>as FinishDate
>Thanks Mullerjannie
>
>sql
Wednesday, March 21, 2012
How can I Add 02.45 hour to my Date [solution is that best way?]
Labels:
adddate,
database,
date,
datetimedeclare,
datetimeset,
microsoft,
mysql,
oracle,
server,
solution,
solutiondeclare,
sql,
startdate
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment