Re: Convert any date format to ISO

2013-07-27 Thread Michael Brader
On 07/26/2013 06:10 AM, Charles DeRykus wrote: On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader mailto:mbra...@internode.com.au>> wrote: [...] There are at least 2 modules that can definitely do the job for you, Date::Manip::Date and DateTime (with DateTime::Format::Natural). I

Re: Convert any date format to ISO

2013-07-27 Thread Charles DeRykus
On Fri, Jul 26, 2013 at 4:45 AM, Perl Beginners wrote: > On 07/25/2013 04:40 PM, Charles DeRykus wrote: > >> >> >> >> On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader < >> mbra...@internode.com.au >> > >> wrote: >> >> >> On 07/25/2013 10:14 AM, mimic...@gma

Re: Convert any date format to ISO

2013-07-25 Thread Charles DeRykus
On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader wrote: > > On 07/25/2013 10:14 AM, mimic...@gmail.com wrote: > > I was trying to use Date::Simple to convert date from DD-MM- to ISO > standard -MM-DD, but it produced error below because it returned undef > when the date passed is not ISO

Re: Convert any date format to ISO

2013-07-24 Thread Michael Brader
On 07/25/2013 03:26 PM, Jim Gibson wrote: You don't need a module to recognize a date in the form DD-MM- and change it into the form -MM-DD (untested): if( $date =~ /^(\d\d)-(\d\d)-(\d\d\d\d)$/ ) { $date = "$3-$2-$1"; }else{ # try other conversions } Jim's right, but be aware

Re: Convert any date format to ISO

2013-07-24 Thread Jim Gibson
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- to ISO > standard -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

Re: Convert any date format to ISO

2013-07-24 Thread Michael Brader
On 07/25/2013 10:14 AM, mimic...@gmail.com wrote: I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. Yeah on quick scan of the perldoc it looks like Date:

Re: Convert any date format to ISO

2013-07-24 Thread mimic...@gmail.com
I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. $ perl -e 'use Date::Simple (":all");$date = Date::Simple->new("29-01-1972"); $x = $date->as_iso; print "