CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Date Compared

 



okalani
Deleted

Oct 24, 2000, 11:29 AM

Post #1 of 3 (288 views)
Date Compared Can't Post

Hello everyone,

I've searched around to find a topic on comparing dates but could only find one. Can someone tell me how to go about comparing a date (epoch seconds) in a record to see if it is older than a predifined day, for example 30 days old? I'm just not sure how to use the time in the record to get the desired results. Thanks

Ikaika


okalani
Deleted

Oct 24, 2000, 12:20 PM

Post #2 of 3 (288 views)
Re: Date Compared [In reply to] Can't Post

Hello,

I think I should make my question above more clear:

I have a flat-file database that is piped delimited and it looks like this, 123|Joe|Blow|date&time| and so on, I want to loop through the file to look for any records that may be older than the time I provide, for example, 30 days or 10 days. The date and time was retrieved from the $time = time() function and is stored in its raw form. I've been working on this for a few days and my brains is just about fried, so now I'm turning to the experts for a solution or some advise as how to get the desired results. Thanks

Ikaika


vpopper
Deleted

Oct 24, 2000, 3:07 PM

Post #3 of 3 (288 views)
Re: Date Compared [In reply to] Can't Post

 <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">quote:</font><HR>Can someone tell me how to go about comparing a date (epoch seconds) in a record to see if it is older than a predifined day, for example 30 days old?<HR></BLOCKQUOTE>

$now = time();
$day = 60*60*24;
$cutoff = $now - ($day * 30);

if ($date < $cutoff) {
# older...

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives