There is a library for PHP where I can inform a date as a String, the current format used in the String and the output format to some function/method to convert the date?
Example:
convertDate('d/m/Y', 'y.m.d', '11/03/1991') # will output 91.03.11
I didn’t find a simple way to do this only with PHP functions because they expect a date in a specific format (eg.: MM/DD/YYYY) and not any format.
I can do this with some coding for specific formats, but I’m searching something broader because I think it will be useful in several projects.
DateTime objects – read about them in the manual: http://www.php.net/manual/en/book.datetime.php, particularly the createFromFormat() method http://www.php.net/manual/en/datetime.createfromformat.php