|Public Scratchpad||Download, Select Code To D/L|
Must read nodesThis list is a permanent place of the dynamic Personal Nodelet of mine. In no particular order (but I may need to categorize them in the future):
- Linking shortcut
- Recommended Reading
- I know what I mean. Why don't you?
- How (Not) To Ask A Question
- brian's Guide to Answering Questions
- Funniest Nodes of 2004
- Why CGI::Application?
- The fine art of database programming
- Before asking a database related question ...
- Tricks with DBI
- Understanding and Using PerlMonks
- How To Use PerlMonks - For the Absolute Beginner
Attempts of contribution
Q&A: How do I convert date format between 'DD-MM-YYYY' and 'YYYY-MM-DD' back and forth?
|2007-05-09 02:34 WIT||placed||placed on dates and time Q&A|
|2007-05-08 23:36 WIT||draft|
|2007-04-30 17:09 WIT||planned||initial|
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)?
(Thanks to Corion, davido, and jdporter for their reviews on the draft)
After discussing with Corion, davido, and jdporter, and rethinking the context, I came up with three answers:
Answer 1: join the reverse of split-ted date string
Answer 2: the case of US-style, with array slice
Answer 3: another approach using regexes
jettero added the fourth answer using Date::Manip
Just some thoughtsWell, I'm still thinking about what else to put... ;-) Some candidates:
- on node (up/down) voting
- on personal (up/down) voting
- on considered note voting
- on social aspect of PerlMonks
- on front-paging a node
- on XP system
---- It's not wise to post a reply that points to previous own nodes, or to a thread that contains one. I did this a few times but wasn't aware of the implications. While it's actually a good thing because it provides references related to the OP substance, it's simply a shameless plug. I've seen some monks replied this way but did it more appropriately than I did. (Jun 23, 2007 at 00:05 WIT)
---- Since I intented to give quick answers so the OPs could find the answer themselves, I posted many times oneliner reply that merely provided links to CPAN modules or in-site resources. In the future, I'll just do this via /msg. (Jun 23, 2007 at 00:05 WIT)
Non-technical related discussion
- Free online Perl Practice tests
- Building a Perl based business
- How to convince a client to release Perl code to CPAN?
CGI programming problems
- newb: Best way to protect CGI from non-form invocation?
- If CAPTCHA isn't the answer. What is?
- Is using 'Cookies' impractical for 'Contact Us' forms?
Approval weirdnessGo figure :-)
[naikonta]:i tried to approve [id://624900|this node], but the status +didn't change. what happens? [tye]:someone feel for the trap when moving / approving nodes covered +in the site documentation [naikonta]:if it's about page reloading, i don't think this is the cas +e. i don't any other traps. [naikonta]:i don't know any traps [naikonta]:tye, what do you mean by the "trap" when approving the node +s? [tye]:moving a node to a different section then approving the node whi +le the nodelet still thinks it is in the original section [naikonta]:but i didn't move the node, only ticked the approve check b +ox and clicked the moderate button [naikonta]:i didn't change the section [naikonta]:it just stayed unapproved (until almut approved it later) [tye]:sometimes "someone" ne "you", no? [naikonta]:the section stays the same up to now, i believe [marto]:I moved that node [naikonta]:i thought the moving/approving trap could only happened on +the same browser by the same person [naikonta]:so i guess marto moved the node, i came later trying to app +rove it (it's already in the new section after moved by marto) so I w +as supposed to be able to approve it [naikonta]:but it stayed unapproved, i tried again and still stayed th +e same. i reloaded the browser, still unable to approve. i opened the + node in an a new tab, trying to approved and it stayed unapproved. [naikonta]:what i didn't try is quiting and relaunching the browser [naikonta]: but i still believe there's an explanation somewhere i mig +ht be too dumb to understand [jZed]:sounds like religion [fenLisesi]:the truth is out there [naikonta]:well, maybe i'll dream about it, later in my sleep (if I ev +er get sleep) tonight :D [tye]:trying to approve to wrong section leaves node in state where ca +n't be approved until a janitor fixes [tye]:someone fix the docs to be less vague [naikonta]: tye, so when i was viewing on that node, it was on section + A. At that time the node was moved to a different section, B. [naikonta]: When I clicked the moderate button, I was actually trying +to approve that node that I still viewed as in section A but it had b +een actually moved to section B [naikonta]: so basically I was trying to approve a node in the wrong s +ection. Is it the case? [tye]:no [tye]:someone ne you. reread :) [naikonta]:the "someone" in your "someone feel for the trap when movin +g / approving nodes covered in the site documentation"? [tye]:yeah, that too [naikonta]:tye, the nodelet is "someone"? [clinton]:naikonta i think by "somebody ne you", tye meant, "somebody, + not you" [naikonta]: i get that, clinton. what i don't get yet is what "someone +"/" somebody" tye refers to. [naikonta]: previously he said "moving a node to a different section t +hen approving the node while the nodelet still thinks it is in the or +iginal section" [clinton]: somebody other than you, who happened to be doing something + to the same node at the same time? (haven't been following the conve +rsation) [naikonta]: could be "someone" is "nodelet" cause "nodelet still think +s ...." [bart]: naikonta the page is in two states. You need to reload the pag +e for it being completely in the new state. [clinton]:naikonta nodelets don't think. They lied to you [bart]: clinton if you want to move and approve you have to 1) move 2) + reload 3) approve [clinton]: bart yes - i've got that. It's naikonta who is puzzled [naikonta]: i did that bart, i also reopened the node so it must be eq +ual to reloading [clinton]: if i remember correctly, tye said that that node had entere +d a state which requires janitorial assistance, ie there is nothing m +ore that you can do about it [bart]: Reopening the node is actually safer. [clinton]: probably because two people were doing things to it at the +same time [naikonta]: i understand about the node state. just don't get what exa +ctly happened at that particular moment.