Good evening monks!!
I've got a small question here.
I'm currently working on a application that checks out webpages for errors and such and uploads the info gathered to a database. Its almost done! But I'm just missing one thing. I can't get the datetime to be uploaded to the database. So, here's what I've got:
When I use this line:
my $time = localtime(time); the resulting string is like this:
Wed Mar 30 00:13:59 2005 . However, I need that info to look like this:
2005-03-30 00:13:59.
I know...this is REALLY simple stuff :S Now, the problem is that I am clueless as to how I can manage to work with this string bit by bit, reformatting every "word" to create a string understandable by MySQL.
First I would like to know if there is any module out there that can do this form me. I've checked in CPAN under "datetime" search, but I don't seem to find anything of interest. If there is none, I can do it myself right now, but for that, I would need someone to explain me first how to go through the string, word by word.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.