Perl function that takes a number and returns a string (YYYYMMDD) of today's date minus the input number of days

Hopefully this is straightforward for a Perl wizard.  I'm sure the function is on the Web somewhere if I could find it.  I need a Perl function that does this (in pseudocode):

GetDateStamp(numDays)
{
    return (today - numDays) as YYYYMMDD
}

If I need to include a module or anything, that's fine; just let me know.

Thanks!
-Dave
JediBeckerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
sub GetDateStamp{
my $time=time;
return  strftime"%Y%m%d",localtime $time+60*60*(12-(localtime$time)[2]-24*shift);
}
0
ozoCommented:
use POSIX;
sub GetDateStamp{
my $time=time;
return  strftime"%Y%m%d",localtime $time+60*60*(12-(localtime$time)[2]-24*shift);
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JediBeckerAuthor Commented:
Perfect!
0
JediBeckerAuthor Commented:
Thanks, Ozo!  That's perfect.  However, when writing the question, I moronically forgot to include the stipulation that the days to subtract should be business days.  So it needs to take weekends into account.  Since you answered exactly what I asked, I graded that.  I'm going to post the same question with the business day requirements right now, if you are interested in helping with that, too.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.