Issue
I am writing junit tests that uses h2 . Oracle uses a different format ('03-february-20'). H2 database throws error for that format ('2020-02-03').
I need to convert a string 03-february-20
into date 2020-02-03
in a query in h2 database. Please let me know how to do it?
Solution
Use PARSEDATETIME for example:
create table DATE_EXAMPLE (
EXAMPLE DATE
);
insert into DATE_EXAMPLE values ('2020-02-03');
select * from DATE_EXAMPLE where EXAMPLE = PARSEDATETIME('03-february-20','dd-MMMM-yy');
Answered By - Oleg
Answer Checked By - Katrina (JavaFixing Volunteer)