Page 1 of 1

date/time question

Posted: Tue Jun 10, 2008 8:41 pm
by dbusher
I am a newbie at php but having a good time learning to use it to access my database.
I have a table with a field filled by now() an example would be:
20080610133822

I wrote a php script that gets the last 5 rows from the database and displays it on the webpage. an example would be like this:

TravelBug Name: Sue
Location: Asura
Difficulty: Easy
When posted: 20080610133822

Does anyone have a code snippet that would take this field and compare it to current time and post something like this:

TravelBug Name: Sue
Location: Asura
Difficulty: Easy
When posted: less than a minute ago

OR

....
When posted: 1 hour 4 min ago

Thanks for your help

Re: date/time question

Posted: Wed Jun 11, 2008 12:52 am
by RobertGonzalez
Have you looked at hotscripts yet? You generally are not going to find people giving you code here. We will help you code it, but that is generally the extent of our help.

Re: date/time question

Posted: Wed Jun 11, 2008 8:48 pm
by superdezign
Well, I just finished my website and since this was something that I developed for my website, I decided that it'd be the first piece of content I'd put up. Just visit this tutorial for displaying relative time of dates to the current time. I tried my best to explain as much as necessary. ;)