Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 417 Bytes

date-format.md

File metadata and controls

17 lines (12 loc) · 417 Bytes

Formatting Dates in Oracle

Trying to retrieve records by modifiedDate, right?

SELECT * FROM records
WHERE modifiedDate = '2019-02-12'

This finds no results - why? Because modifiedDate is a timestamp column, and we need to trim the time so the user can filter by date only.

SELECT * FROM records
WHERE TO_CHAR(modifiedDate,'YYYY-MM-DD') = '2019-02-12'

Good old TO_CHAR() to the rescue!