PHP how to change the time

Associate
Joined
28 Feb 2007
Posts
969
Location
Leeds/Sunderland
How can i change the time so it -1 hour or uk time
heres the code:
PHP:
<?php
header ("Content-type: image/png");
header ("refresh: 1 ");
$img = imagecreatefrompng ("sig.png");
$colour = ImageColorAllocate ($img, 1000, 200, 100);
$read1 = date("D dS M y ");
$read2 = date(" h:i:s A");
$input = ($read1);
$input1 = ($read2);
ImageString($img, 3, 140, 25, $input, $colour);
ImageString($img, 3, 150, 40, $input1, $colour);
imagepng($img);

?>
 
PHP:
$read2 = date(" h:i:s A");
to

PHP:
$thetime = date('h')-1;
$read2 = $thetime.':'.date('i:s A');
 
How can i change the time so it -1 hour or uk time
heres the code:
PHP:
$input = ($read1);
$input1 = ($read2);
ImageString($img, 3, 140, 25, $input, $colour);
ImageString($img, 3, 150, 40, $input1, $colour);

You dont need those top 2 lines.

Just do this....
PHP:
ImageString($img, 3, 140, 25, $read1, $colour);
ImageString($img, 3, 150, 40, $read2, $colour);
You're basically just renaming a variable, there's no need.

I covered it in the first thread you made regarding this code... ;)
http://forums.overclockers.co.uk/showthread.php?t=17920484

This area...
PHP:
header ("refresh: 1 ");
Will not work as the header of a given page, such as this one we're viewing has already been parsed at the top of the page <head>, if you want the time to refresh you'll need to do it in flash or find another method, javascript perhaps.

Of course it works if you go directly here...
http://www.oddwire.frih.org/sig/random.php

That's because the header has not yet been declared, so it functions, but in honesty with it refreshing every second, if it did work remotely, such as here, you be refreshing the whole page and not just the sig.

That in mind you won't be able get what i think you're trying to archive.
 
Last edited:
Back
Top Bottom