Groups > Novell > Perl for NetWare > Re: How to convert and calculate date differences?




How to convert and calculate date differences?

How to convert and calculate date differences?
Fri, 25 Aug 2006 19:48:54 GMT
Hi,

I am trying to calculate how long ago a file was archived and take action 
if it is too old.  I can get the last archived date of a file in a format 
such as:

mm/dd/yyyy hh:mm:ss

However when I check the current time I get a big long number of seconds.  
I don't know how to convert between the two.  Does anyone out there know 
how?

Post Reply
Re: How to convert and calculate date differences?
Sat, 26 Aug 2006 01:18:43 GMT
Hi Brian,

Brian Mantler <brianmantler@nowhere.com> wrote in 
news:Xns982AA0E0E408Bbrianmantlernowherec@130.57.1.81:

> Hi,
> 
> I am trying to calculate how long ago a file was archived and take action 
> if it is too old.  I can get the last archived date of a file in a format 
> such as:
> 
> mm/dd/yyyy hh:mm:ss
> 
> However when I check the current time I get a big long number of seconds. 

> I don't know how to convert between the two.  Does anyone out there know 
> how?
see my old samples:
http://www.gknw.net/nwperl/perlscripts/abendchk.txt
and probably:
http://www.gknw.net/nwperl/perlscripts/cleanup.txt

Guenter.
Post Reply
Re: How to convert and calculate date differences?
Mon, 28 Aug 2006 16:49:43 GMT
Hi,

I have installed the Date:Parse.pm, Date:Format.pm and Time:zone.pm 
modules.

When I try to run the following code:

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
		$atime,$mtime,$ctime,$blksize,$blocks)=stat($fullpath);

$Entry = $FileMgr->FindEntry($fullpath) ; # fullpath is the name of a 
file
$EntryArc =  $Entry->{'ArchiveDate'};
$temp = $EntryArc;
$temp =~ s/\./\:/g;	# replace . with : for str2time()
$stamp = Date::Parse::str2time($temp);

I get 'Undefined subroutine &Datte::Parse::str2time'

Ay ideas?

Thanks.

Guenter <devforums@novell.com> wrote in
news:TjNHg.916$PP.878@prv-forum2.provo.novell.com: 

> Hi Brian,
> 
> Brian Mantler <brianmantler@nowhere.com> wrote in 
> news:Xns982AA0E0E408Bbrianmantlernowherec@130.57.1.81:
> 
>> Hi,
>> 
>> I am trying to calculate how long ago a file was archived and take
>> action if it is too old.  I can get the last archived date of a file
>> in a format such as:
>> 
>> mm/dd/yyyy hh:mm:ss
>> 
>> However when I check the current time I get a big long number of
>> seconds.  I don't know how to convert between the two.  Does anyone
>> out there know how?
> see my old samples:
> http://www.gknw.net/nwperl/perlscripts/abendchk.txt
> and probably:
> http://www.gknw.net/nwperl/perlscripts/cleanup.txt
> 
> Guenter.
> 
Post Reply
Re: How to convert and calculate date differences?
Mon, 28 Aug 2006 19:06:02 GMT
Please disregard that last message.  I mistyped the use section.

All seems to be working OK.

Thanks.


Brian Mantler <brianmantler@nowhere.com> wrote in 
news:Xns982D827F49187brianmantlernowherec@130.57.1.81:

> Hi,
> 
> I have installed the Date:Parse.pm, Date:Format.pm and Time:zone.pm 
> modules.
> 
> When I try to run the following code:
> 
> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
>           $atime,$mtime,$ctime,$blksize,$blocks)=stat($fullpath);
> 
> $Entry = $FileMgr->FindEntry($fullpath) ; # fullpath is the name of a 
> file
> $EntryArc =  $Entry->{'ArchiveDate'};
> $temp = $EntryArc;
> $temp =~ s/\./\:/g;     # replace . with : for str2time()
> $stamp = Date::Parse::str2time($temp);
> 
> I get 'Undefined subroutine &Datte::Parse::str2time'
> 
> Ay ideas?
> 
> Thanks.
> 
> Guenter <devforums@novell.com> wrote in
> news:TjNHg.916$PP.878@prv-forum2.provo.novell.com: 
> 
>> Hi Brian,
>> 
>> Brian Mantler <brianmantler@nowhere.com> wrote in 
>> news:Xns982AA0E0E408Bbrianmantlernowherec@130.57.1.81:
>> 
>>> Hi,
>>> 
>>> I am trying to calculate how long ago a file was archived and take
>>> action if it is too old.  I can get the last archived date of a
file
>>> in a format such as:
>>> 
>>> mm/dd/yyyy hh:mm:ss
>>> 
>>> However when I check the current time I get a big long number of
>>> seconds.  I don't know how to convert between the two.  Does
anyone
>>> out there know how?
>> see my old samples:
>> http://www.gknw.net/nwperl/perlscripts/abendchk.txt
>> and probably:
>> http://www.gknw.net/nwperl/perlscripts/cleanup.txt
>> 
>> Guenter.
>> 
> 
Post Reply
about | contact