I need to change date format of many values in a SQL file.
There are date values which are in the 'DD-MON-RR' format but I need them to be in the 'YYYY-MM-DD' format.
In the file I have dates from 21th century and 20th century:
to_date('01-Nov-20','DD-MON-RR'),to_date('28-Dec-99','DD-MON-RR')
I'm searching for a regex to find and replace those values.
This was my first try, works even with the 20th century years:
FIND:
(\d{2})-(\w{3})-(([0-4])\d|[5-9]\d)
REPLACE:
(?{4}20:19)\3-\2-\1
This one helps to reorder the position of elements but I have to replace all the months with related numbers.
Now I'm searching for something to find and replace month names in the same regex:
FIND:
(\d{2})-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-(([0-4])\d|[5-9]\d)
Now I'm having trouble trying to write the replace expression, someone can help me?
Thank you
