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.
Author |
Topic |
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2015-03-12 : 01:10:40
|
how can i get for time which in 30min.example yesterday 930pm till today 930pm?i tried this:select * from tableAwhere dateadd(hour,21,DATEDIFF(d,0,getdate()-1)) and getdate() |
|
mhorseman
Starting Member
44 Posts |
Posted - 2015-03-12 : 04:32:42
|
Sorry, I'm not quite sure what you want. If it's just yesterday at 9.30pm, then:select dateadd(MINUTE,1290,DATEDIFF(d,0,getdate()-1))Mark |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2015-03-12 : 06:10:35
|
select dateadd(day,datediff(day,0,getdate()),-1)+'9:30:00' and dateadd(day,datediff(day,0,getdate()))+'9:30:00'MadhivananFailing to plan is Planning to fail |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2015-03-12 : 07:04:06
|
DateCol >= DATEADD(DATEDIFF(DAY, '19000101', GETDATE()), '18991231 21:30:00')AND DateCol < DATEADD(DATEDIFF(DAY, '19000101', GETDATE()), '19000101 21:30:00') Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|