...

View Full Version : How to change time



Nils Juel
01-17-2004, 09:51 PM
Can somebody tell me how to add one hour to this Gmt time
I live i Oslo an get wrong time - one hour less.
Please help
My code :
<?php
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600)." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<?php

/* Modified for Flashkit by swissLyons: http://www.flashbuilder.ch based on

the http://www.peopleforfun.com version */
/* Original script by Nicola Delbono <key5@key5.com> */
?>

<?php
$nickname = str_replace ("\n"," ", $nickname);
$nickname = str_replace ("<", " ", $nickname);
$nickname = str_replace (">", " ", $nickname);
$nickname = stripslashes ($nickname);
$p=gmdate("d M H:i");

?>

&output=
<?php
$chat_file = "shout.txt";
$chat_lenght = 360;
$max_single_msg_lenght = 100000;
$max_file_size = $chat_lenght * $max_single_msg_lenght;
$file_size= filesize($chat_file);
if ($file_size > $max_file_size) {
$lines = file($chat_file);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
$msg_old = $lines[$i] . $msg_old;
}
$deleted = unlink($chat_file);
$fp = fopen($chat_file, "a+");
$fw = fwrite($fp, $msg_old);
fclose($fp);
}
$msg = str_replace ("\n"," ", $message);
$msg = stripslashes ($msg);
if ($msg != ""){
$fp = fopen($chat_file, "a+");
$fw = fwrite($fp, "<b>$nickname:($p)<br></b>$msg\n");
fclose($fp);}
$lines = file($chat_file);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
echo $lines[$i];
}

Nightfire
01-17-2004, 10:47 PM
Put this at the top of the script



putenv("TZ=Europe/Oslo");

Nils Juel
01-17-2004, 11:10 PM
Thank yoy
I put the code at the top, but I still have one hour early

Nightfire
01-18-2004, 01:42 AM
Ahh, just noticed why. Change

$p=gmdate("d M H:i");

to

$p=date("d M H:i");

That should also fix it :)

Nils Juel
01-18-2004, 12:05 PM
Hello Nightfire

Thank you !!!
The problem is solved



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum