How to compare different format date in oracle?

Member

by deron , in category: MySQL , 7 months ago

How to compare different format date in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dana , 7 months ago

@deron 

To compare different format dates in Oracle, you can use the TO_DATE function to convert the dates to a standard format before comparing them. Here is an example query to demonstrate how to compare different format dates in Oracle:

1
2
3
SELECT *
FROM your_table
WHERE TO_DATE(date_column, 'DD/MM/YYYY') > TO_DATE('01/01/2022', 'DD/MM/YYYY');


In this query, 'date_column' is the column containing dates in different format and 'your_table' is the name of the table. The TO_DATE function is used to convert the 'date_column' values to the format 'DD/MM/YYYY' before comparing them to the specified date ('01/01/2022' in this case).


By converting all dates to the same format using TO_DATE, you can easily compare them in your SQL query.

Related Threads:

How to compare date to format date on oracle?
How can convert date format in oracle?
How to convert date to gmt format using oracle?
How to change date format to 'dd-mon-yy' in oracle?
How to compare two different time in moment.js?
How to compare moment.js date?