View Single Post
  #3 (permalink)  
Old 04-28-04, 02:11 PM
mickey_kamer mickey_kamer is offline
New Member
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Roger
Mickey,

Thanks for your post and effor, but there's a better and easier solution for what you need with the Date::Manip module, with just two lines of code:

use Date::Manip;

$60date = DateCalc("today","- 60 days",\$err);
$date = UnixDate($60date,"%Y%m%d");

I hope this helps.

Roger
Roger,

Your solution would be quick and easy however when I tested it using what you have above I got nothing but the following errors:


Bareword found where operator expected at line 2, near "$60date"
(Missing operator before date?)
Bareword found where operator expected at line 3, near "$60date"
(Missing operator before date?)
syntax error at line 2, near "$60date "
syntax error at line 3, near "$60date"
Execution aborted due to compilation errors.
---------------------------------------------------------------------
Since I do not know why I am getting the errors I tied this:
use Date::Manip;
$date2 = DateCalc("today","-60 days",\$err);
$date = UnixDate($date2,"%Y%m%d");

Thinking the leading number in a varible would be a problem I changed from $60date to $date2.

Now I get the following error:
ERROR: Date::Manip unable to determine TimeZone.
Date::Manip:ate_TimeZone called at C:/Perl/site/lib/Date/Manip.pm line 661
Date::Manip:ate_Init() called at C:/Perl/site/lib/Date/Manip.pm line 779
Date::Manip:arseDateString('today') called at C:/Perl/site/lib/Date/Manip.pm line 1479
Date::Manip:ateCalc('today','-60 days','SCALAR(0x2924980)') called at test.pl line 2

So, I don't have a clue as to what is going on here.
Reply With Quote