Thanks Gunnar for the suggestions. In which version of perl is Parse module available.
We have perl version 5.8.0 and parse module is not available. Rajini >-----Original Message----- >From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc] >Sent: Tuesday, January 27, 2009 7:42 PM >To: beginners@perl.org >Subject: Re: Query in Perl Programming > >S, Rajini (STSD) wrote: >> Hi, >> >> I am new to Perl Programming and have a query in perl. >> >> In perl is there any system defined functions to find out the >> Differences in dates. >> >> Eg : >> >> Date 1 -> 26-Jan-2009 >> Date 2 -> 14-Jan-2009 >> >> So the difference between two dates is 12 days. >> >> Is there a way to achieve this with any system defined functions In >> Perl ???? > >It depends on what you mean by "system defined functions". As >others have told you, there are many CPAN modules that deal >with date and time related tasks. Your particular problem can >be easily solved using only a module that is included in the >standard Perl distribution. > > use Date::Parse; > > my $time1 = str2time '26-Jan-2009'; > my $time2 = str2time '14-Jan-2009'; > > print 'Difference: ', > sprintf( '%.0f', ($time1-$time2)/86400 ), " days\n"; > >-- >Gunnar Hjalmarsson >Email: http://www.gunnar.cc/cgi-bin/contact.pl > >-- >To unsubscribe, e-mail: beginners-unsubscr...@perl.org For >additional commands, e-mail: beginners-h...@perl.org >http://learn.perl.org/ > > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/