Gayner Posted August 27, 2009 Share Posted August 27, 2009 $row['post_date'] = get_date($row['post_date']); That gives me error: Fatal error: Call to undefined function get_date() in C:\wamp\www\forums\sources\Topics.php on line 839 $row['post_date'] is like a a whole bunch of numbers EXAMPLE: "1251363321" I want to convert that into a Date, how would i? Quote Link to comment https://forums.phpfreaks.com/topic/172098-solved-php-date-help-simple-for-you/ Share on other sites More sharing options...
ignace Posted August 27, 2009 Share Posted August 27, 2009 You are missing a custom function named get_date() Quote Link to comment https://forums.phpfreaks.com/topic/172098-solved-php-date-help-simple-for-you/#findComment-907382 Share on other sites More sharing options...
Gayner Posted August 27, 2009 Author Share Posted August 27, 2009 You are missing a custom function named get_date() Yea i know that function is: function get_date($date = "", $method = "", $override = FALSE, $detailed = false, $noclock = false) { global $ibforums; if (!$date) { return '--'; } if (empty($method)) { $method = 'LONG'; } if ($this->offset_set == 0) { $this->offset = $this->get_time_offset(); $this->offset_set = 1; } if (!isset($this->Date_Replace_Array)) { $this->set_time_replace(); } if ($ibforums->vars['use_relative_date'] && !$override) { $now = mktime(); $today = gmdate("F j Y", $now + $this->offset); $yesterday = gmdate("F j Y", $now - 86400 + $this->offset); $tomorrow = gmdate("F j Y", $now + 86400 + $this->offset); $this_date = gmdate("F j Y", $date + $this->offset); if ($this_date == $today) { if ($noclock) { return $this->lang['rel_today_noclock']; } else if ($now == $date) { $rel_date = $this->lang['rel_now']; return str_replace("{time}", $now - $date , $rel_date); } else if ($now - $date > 0 && $now - $date < 60) { $rel_date = $this->lang['rel_seconds']; return str_replace("{time}", $now - $date , $rel_date); } else if ($date - $now > 0 && $date - $now < 60) { $rel_date = $this->lang['rel_seconds_soon']; return str_replace("{time}", $date - $now , $rel_date); } else if ($now - $date > 0 && $now - $date < 3600) { $rel_date = $this->lang['rel_minutes']; return str_replace("{time}", round(($now - $date)/60) , $rel_date); } else if ($date - $now > 0 && $date - $now < 3600) { $rel_date = $this->lang['rel_minutes_soon']; return str_replace("{time}", round(($date - $now)/60) , $rel_date); } else if ($date - $now > 0){ if ($detailed) { $hours = floor(($date - $now)/3600); $minutes = round((($date - $now) % 3600)/60); if ($hours == 1) if ($minutes == 1) $rel_date = $this->lang['rel_today_soon_h_m']; else $rel_date = $this->lang['rel_today_soon_h']; else if ($minutes == 1) $rel_date = $this->lang['rel_today_soon_m']; else $rel_date = $this->lang['rel_today_soon_hm']; $rel_date = str_replace("{hours}", $hours, $rel_date); $rel_date = str_replace("{minutes}", $minutes, $rel_date); } else { $rel_date = $this->lang['rel_today_soon']; } $method = $this->lang['time_format_rel']; $rel_date = str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date); return $rel_date; } else { if ($detailed) { $hours = floor(($now - $date)/3600); $minutes = round((($now - $date) % 3600)/60); if ($hours == 1) if ($minutes == 1) $rel_date = $this->lang['rel_today_h_m']; else $rel_date = $this->lang['rel_today_h']; else if ($minutes == 1) $rel_date = $this->lang['rel_today_m']; else $rel_date = $this->lang['rel_today_hm']; $rel_date = str_replace("{hours}", $hours, $rel_date); $rel_date = str_replace("{minutes}", $minutes, $rel_date); } else { $rel_date = $this->lang['rel_today']; } $method = $this->lang['time_format_rel']; $rel_date = str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date); return $rel_date; } } if ($this_date == $yesterday) { if ($noclock) { return $this->lang['rel_yesterday_noclock']; } $rel_date = $this->lang['rel_yesterday']; $method = $this->lang['time_format_rel']; return str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date); } if ($this_date == $tomorrow) { if ($noclock) { return $this->lang['rel_tomorrow_noclock']; } $rel_date = $this->lang['rel_tomorrow']; $method = $this->lang['time_format_rel']; return str_replace("{time}", gmdate($method, $date + $this->offset) , $rel_date); } } if ($this->time_options[$method] != "") { return Strtr(gmdate((isset($this->lang["time_format_".$method])? $this->lang["time_format_".$method]: $this->time_options[$method] ), ($date + $this->offset) ), $this->Date_Replace_Array); } else { return Strtr(gmdate($method, ($date + $this->offset) ), $this->Date_Replace_Array); } } I dont want to mess around with all that code because it makes it say "2minutes ago" i dont need that, I want exact date, Could u help me on convertin? Quote Link to comment https://forums.phpfreaks.com/topic/172098-solved-php-date-help-simple-for-you/#findComment-907384 Share on other sites More sharing options...
ignace Posted August 27, 2009 Share Posted August 27, 2009 $row['post_date'] = date('F Y', strtotime($row['post_date'])); Quote Link to comment https://forums.phpfreaks.com/topic/172098-solved-php-date-help-simple-for-you/#findComment-907457 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.