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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by burschik
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.