I provide a field for user to type in a date string, mostly in 'DD-MM-YYYY' format, and store it later in MySQL database, which uses 'YYYY-MM-DD' format. But sometimes, users use different separators such as slashes and dots. And in the edit form I have to display the date back to its original form. How do I do that? (Assume the input is in valid date range.)