Please Help my PHP Dating Function.


Posted on 16th Feb 2014 07:03 pm by admin

Hi everyone!

Well here is my code that displays this:

Did you know?Explore Trending and Topic pages for more stories like this.
It works wonderful.




The code is:

Code: function time_elapsed_string($ptime) {
$etime = time() - $ptime;

if ($etime < 1) {
return '0 seconds';
}

$a = array( 12 * 30 * 24 * 60 * 60 => 'year',
30 * 24 * 60 * 60 => 'month',
24 * 60 * 60 => 'day',
60 * 60 => 'hour',
60 => 'minute ago',
1 => 'second'
);

foreach ($a as $secs => $str) {
$d = $etime / $secs;
if ($d >= 1) {
$r = round($d);
return $r . ' ' . $str . ($r > 1 ? 's ago' : '');
}
}
}
But I would like it to say, instead of just 1 Minute ago, make it say "1 Minute 25 Seconds ago"

I would want to add seconds into there on the minutes.

Can somone revamp this and post again the correct way, Thanks for your patience, ( Sorry for my other topic I was too excited) I'm trying to be nice and professional for u.
No comments posted yet

Your Answer:

Login to answer
148 Like 51 Dislike
Previous forums Next forums
Other forums

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

max() problem
I have a while loop to get image names.
Code: $imagequery = mysql_query("SELECT * FROM ad_i

Embed Video Problem
Hey, thanks for looking!

File to be embedded:

Code: <playlist version="1&q

The repetition structure: the while statement not working
New programming student, have assignment as follows:
A restaurant has 4 lunch combos for custom

Accessing Infotype data in dialog program
Hi All
In Dialog programs attributes I didn't see any logical database field. How can I access

I apologise! It's a newbie to PHP feedback form problem!
Hi,

I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% r

server trace logs
could any one tell me from where do i get error logs in xMII??I want to check the reason for dtabase

Applet JTextField Size Problem
Hello,

I recently started making an applet to calculate certain values for airplanes. However

How do i do multi uploads?.
Hey i would like to do this : http://hosting.mrkrabz.net/

I've got the base down you can uplo

How can I get my program to read a larger array ??
Hi:

I have this program that reads from an array to do calculations. The array are just t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash