Seite 1 von 1

Uhrzeit im Forum spinnt.

Verfasst: 05.02.2008 22:19
von tts
Hi,

(angenommene wirkliche Uhrzeit: 21:00)

Wenn ich die Uhrzeit im Forum auf GMT stelle, ist es 20:00, wenn ich GMT +1 einstelle ist es 22:00.

Was soll man da machen? Habe die Heute/Gestern-Mod drin. Auf Sommerzeitumstellung will ich nicht warten.

Code: Alles auswählen

//
// Create date/time from format and timezone
//
function create_date($format, $gmepoch, $tz, $calcDelta=true)
{
   global $board_config, $lang;
   static $translate;

   $time = $gmepoch + (7200 * $tz);
   if ( $calcDelta ) {
	  $midnight = gmmktime(0, 0, 0);
	  $delta = $time - $midnight;
	  if ($delta >= 0 && $delta < 86400)
	  {
		 return $lang['datetime']['Today'] . gmdate('H:i', $time);
	  }
	  else
	  if ($delta < 0 && $delta > - 86400)
	  {
		 return $lang['datetime']['Yesterday'] . gmdate('H:i', $time);
	  }
   }
   $pre_format = @gmdate($format, $time);

   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($pre_format, $translate) : $pre_format;
} 



function create_date1($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)); 
} 
So siehts aus.

1000 Dank

TTS

Verfasst: 06.02.2008 01:58
von tas2580
Hast du mal die Uhrzeit des Servers überprüft?

Verfasst: 06.02.2008 15:54
von tts
Ja die phpinfo sagt es stimmt.
OK Problem gefunden.

Code: Alles auswählen


   $time = $gmepoch + (7200 * $tz);
 
muss heißen:

Code: Alles auswählen


   $time = $gmepoch + (3600 * $tz);