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

RE: Operations with dates

Thread Previous | Thread Next
Wagner, David --- Senior Programmer Analyst --- WGO
December 26, 2002 12:24
RE: Operations with dates
Message ID:
	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 []
Sent: Thursday, December 26, 2002 10:32
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+)/;

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:
For additional commands, e-mail:

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About