• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

tsql how to check if datetime between 9:00pm to 10:pm

i want to check if getdate() is between 9:00 pm and 10:00 pm
0
afifosh
Asked:
afifosh
1 Solution
 
Peter KipropCommented:
Try the below
SELECT  GETDATE() where CONVERT(VARCHAR(8),GETDATE(),108) between '21:00:00' and '22:00:00'

Open in new window


Hope it helps
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now