Ok, lets pretend that i have a lil forum on my website. (i really do) and whenever someone posts a new topic or reply mysql creates a time stamp that, well lets say looks like this "1092791237" and i want to write a little script that says how many min or hour ago that the reply or new topic was posted.
How might i go about that?
Thank you
Anthony
backwords counting
Moderator: General Moderators
-
litebearer
- Forum Contributor
- Posts: 194
- Joined: Sat Mar 27, 2004 5:54 am
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
-
litebearer
- Forum Contributor
- Posts: 194
- Joined: Sat Mar 27, 2004 5:54 am
this is simply the thought process (using MODULUS etc will shorten the coding)
(read psuedo code)
(read psuedo code)
Code: Select all
hours = floor(seconds_elasped / (60*60))
seconds_left_over = seconds_elapsed - (hours*60*60)
minutes = floor(seconds_left_over/60)
seconds = seconds_left_over - (minutes*60)
elapsed_time = hours:minutes:seconds