FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Date: "Days Ago"





moejoe
Hi,

I was wondering if there was a tutorial or if someone could just tell me some script where.
Lets says i have a publish date, and i want to find out how many "days ago" it was publish.

Kind of like a script that subtracts the published date, from the current date, and tells it in forms of "days ago".

Thanks in advanced!
mistuh griddlez
simple solution...

make sure your date is in the time() format thingy...

Code:
echo (int)((time()-$time)/86400) ." days ago";


where $time is the time() thingy...

example

code on that page is

Code:
<?php
$time = mktime(0,0,0,7,6,2007);

echo (int)((time()-$time)/86400) ." days ago";
?>


which means the time is set to july 6th 2007

feel free to play with it since it's in my text editor directory...

http://www.clubcrayon.com/files/text_editor

hope that helps...
rohan2kool
mistuh griddlez wrote:

feel free to play with it since it's in my text editor directory...

http://www.clubcrayon.com/files/text_editor

hope that helps...


you are giving scripting access to your server.. totally open... you know what the consequences could be.. right??
mistuh griddlez
It's just to that one directory...

oh and someone deleted the file Laughing sorry I find that funny...
Dougie1
Yeah, I wouldn't let people have access to your site like this. It isn't a good idea.
mistuh griddlez
yeah i guess you guys are right....I'm gonna go delete it now... Very Happy
Related topics
A tribute to 9/11 Victims..
Microsoft Strikes again
Brazilian airplanes crashed!
Dark Messiah
Problem with email through Thunderbird
Losing the girl who I thoug hwas the one
3 way to fool men
World's Tallest Man Marries
Do we have a soul?
HL2 Episode 2 bug
PLEASE LOCK
First batch file attempt
how much would people pay for all these hardwares?
My own Time Ago Calculation Script in PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.