On Jul 24, 2013, at 5:44 PM, mimic...@gmail.com wrote: > I was trying to use Date::Simple to convert date from DD-MM-YYYY to ISO > standard YYYY-MM-DD, but it produced error below because it returned undef > when the date passed is not ISO standard.
You don't need a module to recognize a date in the form DD-MM-YYYY and change it into the form YYYY-MM-DD (untested): if( $date =~ /^(\d\d)-(\d\d)-(\d\d\d\d)$/ ) { $date = "$3-$2-$1"; }else{ # try other conversions } The module Date::Parse does conversions of string dates into numerical ones (but not the one you need). You probably need to tell people what date formats are acceptable, and reject any that will not convert into an ISO form. Try as many conversions as you can in some reasonable order and stop if you get one that works. > Most of the date modules on CPAN cannot do the job for me. I spent time > reading documentations but as it now stands, I have to do this myself. The DateTime module has a lot of date/time manipulation functions, but not string conversions. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/