Good Day to All:

I need to know if there is a code snippet somewher that will allow me to take a users START DATE and give them a maximum of seven(7) for a END DATE.

Problem is, on my AIX box, we DO NOT HAVE THE Date::Calc Perl Module.

Is there a simple way to calculate this date range.....?????

PLEASE HELP....!!!!!!!:eek:

whats the format of the start date?

Good Morning Kath:

Unfortunately, I come from "BIG_IT_FARM":mad: , but the company I am at now, is a small IOT shop and I just luv'it:mrgreen:

Unfortunately, because of their size, and the distribution of the UNIX admin guys, I do not have the "authorization" at this time to load up modules from CPAN.:-|

So.......I am working on a solution with another one of our members. I will let you know the results.

Thanks much,

Kevin:

whats the format of the start date?

Good Morning Kevin:

The format is as follows:

Start Date:==> 08/01/07
End Date:==> 08/08/07

Basically, give them a range <= seven(7) days. If they exceed this, then, bells, whistles.....abort, retry.........ei-ei-o.

Funny enough, I had actually written this logic years ago, and I am sure I could do it again, .....but my hair is on fire constatnly......!!!

Please let me know. Thanks Kevin!

Kevin:

use Time::Local 'timelocal_nocheck';
use POSIX 'strftime';
my $s_date = '08/01/07';
my $e_date = get_edate($s_date);
print "start date:$s_date, end date: $e_date";
sub get_edate {
   my $s_date = shift || return(0);
   my ($m,$md,$y) = $s_date =~ m|(\d+)/(\d+)/(\d+)|;
   my $epochtime = timelocal_nocheck(0, 0, 0, $md, $m-1, $y);
   return strftime("%m/%d/%y",0,0,0,(localtime($epochtime+604800))[3,4,5]);
}
use Time::Local 'timelocal_nocheck';
use POSIX 'strftime';
my $s_date = '08/01/07';
my $e_date = get_edate($s_date);
print "start date:$s_date, end date: $e_date";
sub get_edate {
   my $s_date = shift || return(0);
   my ($m,$md,$y) = $s_date =~ m|(\d+)/(\d+)/(\d+)|;
   my $epochtime = timelocal_nocheck(0, 0, 0, $md, $m-1, $y);
   return strftime("%m/%d/%y",0,0,0,(localtime($epochtime+604800))[3,4,5]);
}

Kevin:

Thanks for the solution! I have not had a chance to walk thru it in detail. I need to understand the strftime function call and what is going on:eek: ! Can you give a short descritption...???? If not, I greatly appreciate your assistance. Please let me know

google for:

posix strftime function

you will find plenty of resources that explain the strftime function in detail and POSIX in general.

google for:

posix strftime function

you will find plenty of resources that explain the strftime function in detail and POSIX in general.

Kevin:

Thanks Much for your assistance! I will check that site asap.

Kevin:

This question has already been answered. Start a new discussion instead.