|
-
Dec 22nd, 2005, 11:26 AM
#1
Thread Starter
Fanatic Member
Is this possible? Displaying 'New' based on folder dates
Please tell me if what I am thinking is even possible. I have these folders in my photo album. What I would like to do is the following.
Display "New Photos" if the creation date of a folder is within 10 days of the current date.
This way if the date that a fodler was created was...12/10/05, they under the link the text "New Photos" would be written until the date...12/20/05. Then after that its no longer shown.
I would like to use either the creation date or the modified date because I plan to add folders and images into them on my webserver and would like visitors to see when things have been modified. Is this possible with PHP. I have looked all over google and such and have not found any way to do this.
As a side not, does folders on webservers even show things such as modified dates?
-
Dec 23rd, 2005, 08:53 AM
#2
Re: Is this possible? Displaying 'New' based on folder dates
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 23rd, 2005, 10:26 AM
#3
Thread Starter
Fanatic Member
Re: Is this possible? Displaying 'New' based on folder dates
Ok, that worked, I got the date that the folder was modified. Now I need to get the current date and compare the 2. I have never worked with dates before.
Since stat() gives the unix date, is there an easy way to add 10 to this date and then compare with the current date. If the current date is less then the unix+10, show NEW, else dont show anything?
Please help.
-
Dec 23rd, 2005, 10:48 AM
#4
Re: Is this possible? Displaying 'New' based on folder dates
Unix timestamps are just seconds since the unix epoch. To add 10 days, you need to add 10*24 hours, is 10*24*60 minutes, is 10*24*60*60 seconds.
Then you get the current timestamp using time() and compare.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 23rd, 2005, 12:34 PM
#5
Thread Starter
Fanatic Member
Re: Is this possible? Displaying 'New' based on folder dates
This is the code I am using
VB Code:
$folderInfo = stat($filename);
$tempinfo = $folderInfo[9];
$tempinfo = $tempinfo+(7*24*60*60);
$nowtime = time();
if ($tempinfo >= $nowtime) {
echo "<br><font class=swap><strong>New Photos</strong></font>";
}
Right now they all say New Photos becuase i just edited the folders. If i make the 7 into a 0, so its just comparing the modified date to the current date it doenst display anything, like its ment to be. I will check later to see if it does work with the 7 days or not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|