devxlogo

Extracting Dates

Extracting Dates

Question:
How do I extract dates from SQL where the date type is a datetimestamp? I have the following SQL statement:

select * from Patient where PatientDOB = "03/01/58"

It works but doesn’t give me any results due to the 12:00 AM part. How do I solve this?

Answer:
You can solve it by bracketing your dates in the WHERE clause to be WHERE Patient.DOB BETWEEN (startdate) and (enddate).

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist