Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Divide Time

Author  Topic 

asif372
Posting Yak Master

100 Posts

Posted - 2011-08-01 : 01:02:38
I Want to Divide Time by 3.5 how Can I Do this
Just Like This
select (Getdate() /3.5)
THANKS In Advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-01 : 01:19:19
what do you mean "divide time by 3.5" ? Please explain with sample data and expected result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-08-01 : 01:29:23
Seems strange, but I've asked stranger stuff.

Are you looking for something like this:

SELECT
CONVERT(TIME,
DATEADD(SS,
((DATEPART(HH, GETDATE())*3600+ DATEPART(MI, GETDATE())*60+ DATEPART(SS, GETDATE()))/3.5),
'19010101'))
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-01 : 04:32:16
what mean does it make? dividing current time by 3.5? may be you're looking at taking time interval and then manipulating it.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-08-08 : 09:38:22
Multiplication and division on DATETIME column do not make any sense. Thats why It is possible to use

select getdate()+1,getdate()-10

whereas it is not possible

select getdate()*2,getdate()/10


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -