Monday, May 12, 2014

SQL Dates in Where Clauses

I always forget how to do this, so I'm making a post more for my quick reference than anyone else's.  Anyway, this format should work not matter what culture you format your dates in...using Microsoft SQL Server variants anyway...

WHERE datetime_column BETWEEN '20081220 00:00:00.000'
                          AND '20081220 23:59:59.997'

'YYYYMMDD HH:MM:SS:XXX' xxx being milliseconds.

More information here-

No comments: