Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2004, 08:51 PM   PM User | #1
Nils Juel
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Nils Juel is an unknown quantity at this point
How to change time

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];
}
Nils Juel is offline   Reply With Quote
Old 01-17-2004, 09:47 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Put this at the top of the script

PHP Code:
putenv("TZ=Europe/Oslo"); 
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 01-17-2004, 10:10 PM   PM User | #3
Nils Juel
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Nils Juel is an unknown quantity at this point
Thank but it did not work

Thank yoy
I put the code at the top, but I still have one hour early
Nils Juel is offline   Reply With Quote
Old 01-18-2004, 12:42 AM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Ahh, just noticed why. Change

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

to

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

That should also fix it
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 01-18-2004, 11:05 AM   PM User | #5
Nils Juel
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Nils Juel is an unknown quantity at this point
Change of time

Hello Nightfire

Thank you !!!
The problem is solved
Nils Juel is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:21 AM.


Advertisement
Log in to turn off these ads.