Wednesday, November 19, 2014

Changing date format from dd-mm-yyyy to yyyy-mm-dd

Problem
In a text files it was required to convert the date format from dd-mm-yyyy to yyyy-mm-dd. This was repeated across many locations.

Solution
I Eclipse use the regular expression in search and replace
Find : ([0-9][0-9])-([0-9][0-9])-([0-9][0-9][0-9][0-9])
Relace with: \3-\2-\1



No comments: