user3346563
user3346563

Reputation: 39

Conversion of String having date format with AM/PM to DD-MM-YYYY HH24:MI:SS format

Might be simple but I am unable to resolve this.

I want to do a minus the date between 2 tables for validation- One is an external table. The external table has varchar2 for date column -format is 3/03/2014 6:00:28 AM table2 has a date datatype which is of format '03-MAR-2014 06:00:28'.

Can someone help me with this. I am getting errors like ORA29913, ORA 01830 etc while doing minus between 2 after doing a to_date of first string

Thanks,

Upvotes: 0

Views: 15849

Answers (1)

crazycloud
crazycloud

Reputation: 179

for first date convert it like this

select to_date('3/03/2014 6:00:28 AM','DD/MM/YYYY HH:MI:SS PM')  from dual

and then you can subtract date from table2 directly from this date without need for any conversion.

Upvotes: 3

Related Questions