PDA

View Full Version : Timer like facebook?



LMS16
02-12-2010, 01:24 PM
Hi,

Does anyone know how to make a timer like facebooks where it says "2 minutes ago" & "1 hour ago" etc...

+REP for any hel

Lew.

Johno
02-12-2010, 01:28 PM
If you save the time that the action is done at, then compare it against the current time and finally round the time - you would have a similar sort of idea :)

http://stackoverflow.com/questions/2364625/round-php-timestamp-to-the-nearest-minute

Trinity
02-12-2010, 01:58 PM
http://snipplr.com/view/4912/relative-time/
http://www.google.co.uk/search?hl=en&q=php+relative+time

Dentafrice
03-12-2010, 03:13 AM
Save the timestamp.. (<?php $time = time(); ?>), then use a relative time function available almost anywhere.. (just Google around) to do it... be aware of timezones also if you've got a script used across many times zones.

LMS16
03-12-2010, 09:30 AM
Save the timestamp.. (<?php $time = time(); ?>), then use a relative time function available almost anywhere.. (just Google around) to do it... be aware of timezones also if you've got a script used across many times zones.

Ta. Thats exactly what I've done. Im making a staff intranet for working, just thought it would be useful to know when jobs were added :)

Mod close thread. kthnx.

Lew.

Want to hide these adverts? Register an account for free!