-
Posted Time ago function
Hello everybody!
I have seen on many websites. how i can show on my post etc "Posted 2 min ago" I am using mysql. If someone got the function please post it.
Thanks
Emraan
-
-
You can search google for an existing function.
Basically, this is done using if statements then formatting the time.
Use timecodes (number of seconds)
$timenow - $timethen = $timeago;
Then see how "big" $timeago is.
If it's less than 30*60 (30 minutes), then round to nearest minute and display "X minutes ago"
If it's less than (24*60*60)-30 ) (23h30m) then round and display "X hours ago"
Then if not display days (or you can include weeks, months, years, whatever)
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
-
-
Thanks I have found a readymade function
-
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
Bookmarks