FaT3oYCG Posted November 19, 2009 Share Posted November 19, 2009 Yeah but the full string is needed. Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960553 Share on other sites More sharing options...
emopoops Posted November 19, 2009 Share Posted November 19, 2009 the Gayner is just adding something like seconds i dont know why you guys are making it so hard. im pretty sure all that he neeeds to do is divide the etime variable by 60 and then use that one function to uh... get the remainder...(dont round) JUST FMOD() THE DARN THING! $etime = 428939; ///the number differnce $minute = 60; $seconds = fmod($etime, $minute); echo $seconds; i think ive stuck gold here folks. i was right about the main point. this is the EASIEST WAY TO ASS SECONDS. nd if u reread thats what Gayner asked. http://php.net/manual/en/function.fmod.php u guys are u incoherent? i figured it out. look! Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960554 Share on other sites More sharing options...
Gayner Posted November 19, 2009 Author Share Posted November 19, 2009 Obvious Troll is Obvious, lol Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960557 Share on other sites More sharing options...
emopoops Posted November 19, 2009 Share Posted November 19, 2009 xcuse me i just figured it out for you. obvious ignornant postrs are obvious.. but not to themselves..... obviously! cause they are IGNORING THE SOLUTION! Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960558 Share on other sites More sharing options...
FaT3oYCG Posted November 19, 2009 Share Posted November 19, 2009 while im here i feel this is relevant, in a for each loop is there any way to return the value of a key numerically so that the next key and its value can be accessed while in the current loop? Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960568 Share on other sites More sharing options...
roopurt18 Posted November 19, 2009 Share Posted November 19, 2009 Not without altering the current position of the array. Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-960581 Share on other sites More sharing options...
Gayner Posted November 29, 2009 Author Share Posted November 29, 2009 This works? Could probably be shortened but just as a concept: <?php function timeDifference($previousTime) { $epoch = time(); $differenceEpochPrevious = $epoch - $previousTime; $differencePreviousNow = time() - $differenceEpochPrevious; $timeDifferences = array( 'year' => date('Y') - date('Y', $differencePreviousNow), 'month' => date('m') - date('m', $differencePreviousNow), 'day' => date('d') - date('d', $differencePreviousNow), 'hour' => date('H') - date('H', $differencePreviousNow), 'minuite' => date('i') - date('i', $differencePreviousNow), 'second' => date('s') - date('s', $differencePreviousNow), ); $outputString = ''; foreach($timeDifferences as $timeString => $value) { if($value > 1) { $outputString .= $value . ' ' . $timeString . 's '; } elseif($value > 0) { $outputString .= $value . ' ' . $timeString . ' '; } } $outputString .= 'ago.'; return $outputString; } echo(timeDifference(strtotime('-1 year -12 months'))); ?> EDIT: http://gaming-network.ath.cx/time.php YES FINALLY!! 8minutes, 20second's ago! HAha I FINALLY Got this to work thanks to u bro!!! I Really love you no homo but seriously, this script is epic, kudo's to ur brain and soul my broski! lol All i needed was the 20second's ago added to the 8minutes, took us 4pages but i got it! THANKS! AWW CRAP:: Whenever u get to the next minute, it stays at 11minutes ago until the first minute is up then it start's displaying the second after, could u fix this? Quote Link to comment https://forums.phpfreaks.com/topic/181819-please-help-my-php-dating-function/page/3/#findComment-967376 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.