in reply to Format date string

Specifically see, DateTime::Format::MySQL. No matter what you are doing, if it seems to you to be a fairly common thing to do, you can be certain that there is a CPAN module to do it, at http://search.cpan.org. Look there first and always.