develooper Front page | perl.beginners | Postings from December 2002

RE: Operations with dates

Thread Previous | Thread Next
From:
Wagner, David --- Senior Programmer Analyst --- WGO
Date:
December 26, 2002 12:24
Subject:
RE: Operations with dates
Message ID:
113A7A0D1F47D511B92E00D0B7E03DAB033B2650@pmail02.vikingfreight.com
	If you can get the date as stated, I think you would be better off
taking that date and coming up with seconds from your header and then
compare against the current day - 30 days.  Your test for what I assume is
alphanumeric month(ie, Apr, May, etc) would not work as you expect.

	SO if you can get the date in format 26 dec 2002 12:14:00 then you
can come up with the date in seconds and then compare against 30 days(ie, my
$My30DaysPass = time - ( 86400 * 30); ). Then  you can numerically
compare(ie, if ( $MyMailDateSecs < $My30DaysPass ) { # older than 30 days
)else {#not older than 30 days}

A start, but always can provide more if you provide more.

Wags ;)


-----Original Message-----
From: Marcelo [mailto:perl_st@espoltel.net]
Sent: Thursday, December 26, 2002 10:32
To: beginners@perl.org
Subject: Operations with dates 


Hi people ...
I need to erase e-mails based in their dates, when a mail is one month 
old I need to erase it or move it to another folder ... but I don't know 
if I could do operations like :

use Mail::Box::Manager;
$mgr = Mail::Box::Manager->new;
$inbox = "/var/spool/mail/marcelo";
$folder = $mgr->open($inbox);
$msg = $folder->message(3);
$head = $msg->head;
$maildate = $head->get('Date');
@splitdate = split  / /, $maildate;
$mailmonth = $splitdate[1];
$date = localtime;
    $_ = $date;

    /\w+ (\w+) *(\d+) (\d+):(\d+):(\d+) (\d+)/;
    $month=$1;

if ( $mailmonth < $month){
# do something
}
------------------------------------

I don't know if that type of operations are permitted or if it gives me 
the right answer ..., and if there is another way to do that please tell 
me how ...Thanks !


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About