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] On Behalf Of Perl Perl Sent: Tuesday, February 24, 2009 10:08 AM To: 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