Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to query date in sql server

select  *
from events
where event_date between '2020-01-01' and '2020-01-31';

-- can include time by specifying in YYYY-MM-DD hh:mm:ss format:
select  *
from events
where event_date between '2020-01-01 12:00:00' and '2020-01-01 23:30:00';
Source by popsql.com #
 
PREVIOUS NEXT
Tagged: #query #date #sql #server
ADD COMMENT
Topic
Name
8+8 =