AnonymousUser Posted August 8, 2012 Posted August 8, 2012 function DateTime_Parse($time_stamp) { $time_difference = ($_SERVER['REQUEST_TIME']-$time_stamp); $unit = array( 'second', 'minute', 'hour', 'day', 'week', 'month', 'year' ); $lengths = array( 60, 60, 24, 7, 4.35, 12 ); for ( $i = 0; $time_difference >= $lengths[$i]; $i++ ) { $time_difference = $time_difference / $lengths[$i]; } $time_difference = round($time_difference); $date = $time_difference . ' ' . $unit[$i] . (($time_difference > 1 OR $time_difference < 1)?'s':'') . ' ago'; return $date; } line 20... Quote
AnonymousUser Posted August 8, 2012 Author Posted August 8, 2012 all these views and no help lol Quote
Uridium Posted August 8, 2012 Posted August 8, 2012 few factors is this when a user first registers to your game is it happening whilst user has been on your game for a while or ?????? Quote
Lithium Posted August 9, 2012 Posted August 9, 2012 All this views with no error and actually you have not line 20 in there. Code wise you only have up to line 10 in the code bit you shared! Quote
Spudinski Posted August 9, 2012 Posted August 9, 2012 I'm going to leave you guys to figure this one out... It's not that hard. Quote
AnonymousUser Posted August 13, 2012 Author Posted August 13, 2012 fixed for ( $i = 0; $time_difference >= $lengths[$i]; $i++ ) { $lengths[$i] = (array_key_exists($i, $lengths) ? $lengths[$i] : 1); $time_difference = $time_difference / $lengths[$i]; } $time_difference = round($time_difference); $date = $time_difference . ' ' . $unit[$i] . (($time_difference > 1 OR $time_difference < 1)?'s':'') . ' ago'; Quote
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.