Results 1 to 3 of 3

Thread: Setting A Future Date

  1. #1
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Setting A Future Date

    Hello, I am trying to make a script that will show "NEW" next to a file that was uploaded within a week of the current date. I am thinking that if I store the date it is uploaded and then create a date a week in the future, I can use the future date as a time to stop showing "NEW". I just do not have an idea on how to detect if it is over a week since the file was uploaded. I am guessing that it will just be a simple if statement like:
    PHP Code:
    if (date() < $stored['date']) { echo('<b>NEW</b>'); } 
    Anyone have an idea? Thanks.
    Thanks DD, you saved me countless times

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    filemtime() is last modifcation time; fileatime() is last access time; filectime() is the last changed time.

    I'll use mofication for this example. Play with them to figure out what you want.

    PHP Code:
    $file //do stuff here;

    if (filemtime($file)>=(time()-60*60*24*7)) {
      
    //do stuff here;
    }
    else { 
    /**/ 
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, thats what I am looking for. I'll let you know how it woks out
    Thanks DD, you saved me countless times

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •