What I always do to check if something is installed is use the perdoc function 
from the shell to see if the documentation is installed. So I would just do 
this:

perldoc Date::Calc

If it returns the doc, then I know the package is installed. You could also use 
PPM to check.

If it is not installed, then I would do this:

PPM search Date::Calc

If that can find the package, then I would install it doing this:

PPM install Date::Calc

PPM also has a gui version now, but I still just use the command line functions 
... just staying with what is familiar to me.

Here is a quick and dirty example of using the Delta_Days and the Today 
function to compare a date with today and get the integer difference:

use Date::Calc qw(:all);

# Set the list for December 10, 2008:

my @dateParts = (2008, 12, 10);

my $dayDiff = Delta_Days(@dateParts, Today());

print "Difference is $dayDiff days\n";

Hope this helps.

Steve

From: Perl Perl [mailto:perl.solut...@gmail.com]
Sent: Wednesday, February 25, 2009 5:52 PM
To: Steve Howard (PFE)
Cc: perl-win32-users@listserv.activestate.com
Subject: Re: Commaring Two dates or month

Thanks a lot Steve,

     I tried using y to use Date::Calc package in my program.
I am quite new to this programing, so I need one more help.
Could you please tell me how to know Date::Calc is installed at my PC or not.
While trying to use that package, I found message something like " didn't found 
@IN " like that.
When I did some search I got that path should be searched or path should be 
given where the packages are install.
Assume my packages are installed at hypothetical path /usr/perl 5.8.2/Net

How can I include that into my script.

Please excuse me if this is a silly question. But I need help, as I am quite 
new.

I got below information that I have to export the PATH

 export PATH=$PATH:/usr/perl5.8.2/Net

or

PATH=$PATH:/usr/perl5.8.2/Net
export PATH

Thanks a lot.

Regards,
Mujju
On Tue, Feb 24, 2009 at 11:52 AM, Steve Howard (PFE) 
<sthow...@microsoft.com<mailto:sthow...@microsoft.com>> wrote:

Just a suggestion



Why not use the Date::Calc package and use the Delta_Days function? I used to 
use that all the time for things like what I understand you to want to do. 
There are a lot of great date functions built into that package that save a lot 
of time in development.



Steve



From: 
perl-win32-users-boun...@listserv.activestate.com<mailto:perl-win32-users-boun...@listserv.activestate.com>
 
[mailto:perl-win32-users-boun...@listserv.activestate.com<mailto:perl-win32-users-boun...@listserv.activestate.com>]
 On Behalf Of Perl Perl
Sent: Tuesday, February 24, 2009 10:08 AM
To: 
perl-win32-users@listserv.activestate.com<mailto:perl-win32-users@listserv.activestate.com>
Subject: Commaring Two dates or month



Dear All,



         I have to compare two dates. And populate the result based on that.

First date I have received from previous script, which in this form 5-Feb-09.

And I have to compare this date with current date, locatime() . With the 
localtime() I will get the current Day (24),Month (2) & year (2009 )



I will split the old date as below and get the result as below.



$Old_Day = 5;

$Old_Month = Feb.



And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( The 
thing repeated for all months ).



if( $Old_Month eq Feb)

{

  $Old_Month = "2";

}

elsif($Old_Month eq Mar )

{

  $Old_Month = "3";

}

.....

elsif($Old_Month eq Dec )

{

 $Old_Month = "13";

}



And in current month,  which I got from localtime function as,



$Current_Month , which will be 2 (  not sure this is a string or a numric ).



so while substracting or comparing as below,



if (($current_Month - $Old_Month > 10) )

{

  print " Some operation ";

}



Here if I compare with current month with the old_month (Feb) then the result 
is fine.

but if the old_month is something like Jan or Jun something, then I am not 
getting the properl result.



Please let me know how can I compare and Substract two months or two dates in 
above scenario.



Thanks a lot for your kind help.



Regards,

Mujju



_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to