Converting a date in MySQL format to human readable in Perl
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Converting a date in MySQL format to human readable in Perl
Hi,
I have a variable, say $ary[3], which contains a MySQL date eg. "2001-1-19" for 19th Jan, 2001. How do I convert it in Perl to something more human, eg. "19th January, 2001"?
Heh - I would blame it on Resetreset (for asking about a Perl solution), but the truth is, I'm much more comfortable with Perl than databases anyhow. (Also, at a quick glance the MySQL date_format doesn't seem to offer the English_Ordinal convenience function to give 3rd for 3 and 1st for 1. But I imagine it's a lot faster.)
Hi,
I have a variable, say $ary[3], which contains a MySQL date eg. "2001-1-19" for 19th Jan, 2001. How do I convert it in Perl to something more human, eg. "19th January, 2001"?
Thanks.
More human? You don't think you might be culturally biased? I'd guess most people in the world find ISO dates more readable than traditional English dates.
More human? You don't think you might be culturally biased? I'd guess most people in the world find ISO dates more readable than traditional English dates.
Haha, I am a strong advocate about using ISO date format since 1981. I have met nothing than opposition and puzzeled looks. Except for one company I worked for where it was company policy. Even in my current company where they use strictly ISO for broadcast schedules, they use dd-mm-yyyy for the regular administration.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.