|
Posted by Dilemma on 05/26/07 09:06
Anonymous Chief wrote:
> I currently have a script to show webserver time. The downside is that I
> have moved from where the server is and am now 2 hours behind.
>
> How can I modify my sdcript to show server time minus 2 hours? The script
> below only shows server date and time:
>
> <?php
> echo date ("l d F, Y - H:i.s");
>
> I have tried:
> <?php
>
> echo date ("l d F, Y - H-2:i.s");
>
> ...but it would only show Friday 25 May, 2007 - 22-2:40.53
>
> Could someone please help me.
>
> Thanx
>
> Anonymous Chief
>
>
I'm just starting out, but this worked for me
<?php
$hour=date("H")-2;
echo date("l d F, Y - $hour:i.s");
?>
The problem comes if you check at 00 or 01, then
you get -2 and -1 respectively. So the output
looks like "Saturday 26 May, 2007 - -1:00.36".
Navigation:
[Reply to this message]
|