hi everyone, anybody here who knows how I can convert phpbb's post_time into a valid date so that i can use the data.
phpbb post_time's stored value is in this format 1115801821 and i want to just get the Date(August, 2, 2005) thats all.
anyone who can give me a function or sumthing that i can use.
Thanks.
Convert post_time
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
//
// Create date/time from format and timezone
//
function create_date($format, $gmepoch, $tz)
{
global $board_config, $lang;
static $translate;
if ( empty($translate) && $board_config['default_lang'] != 'english' )
{
@reset($lang['datetime']);
while ( list($match, $replace) = @each($lang['datetime']) )
{
$translate[$match] = $replace;
}
}
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
}i have that code but it really is very complicated for me, with all those variables i mean what i want to do is just to get the number of posts for a specific month but i cant understand some codes like where does board_config come from and every other parameters or variables that phpbb used.feyd wrote:phpbb's function to do date's (as of phpbb 2.0.12) I believe.. not sure if it's changed since then..Code: Select all
// // Create date/time from format and timezone // function create_date($format, $gmepoch, $tz) { global $board_config, $lang; static $translate; if ( empty($translate) && $board_config['default_lang'] != 'english' ) { @reset($lang['datetime']); while ( list($match, $replace) = @each($lang['datetime']) ) { $translate[$match] = $replace; } } return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); }
I have tried gmdate and inserted a sample data like in this code
Code: Select all
<?php
$gmepoch = 1116354393;
$format = "D M d, Y g:i a";
$tz = 8;
echo gmdate($format, $gmepoch + (3600 * $tz);
?>can you help me fix this.Parse error: parse error in F:\sample.php on line 7
Thanks