Edit report at https://bugs.php.net/bug.php?id=65201&edit=1

 ID:                 65201
 Updated by:         a...@php.net
 Reported by:        easysurf at easysurf dot cc
 Summary:            Africa/Cairo time off by 1 hour
 Status:             Open
 Type:               Feature/Change Request
 Package:            Date/time related
 Operating System:   Window 8
 PHP Version:        5.5.0
 Block user comment: N
 Private report:     N

 New Comment:

Typing 'time in cairo' into google will show you the same. Anyway, lets see if 
someone else can reproduce the behavior you describe.


Previous Comments:
------------------------------------------------------------------------
[2013-07-06 21:27:02] easysurf at easysurf dot cc

<?php
putenv('TZ=Africa/Cairo');
echo date('l g:i A');
?>

The problem is that your site that sends out the time zone for Africa/Cairo is 
off by an hour.

When I tried the above code it is still one hour off.

Goto:
http://wwp.greenwichmeantime.com/time-zone/africa/egypt/cairo/

You will see that there is a discrepancy between your time and theirs.

Also when I watch CNN with a live feed from Cairo with a timestamp, it does not 
match you time but does match the time that Greenwich sends out.

------------------------------------------------------------------------
[2013-07-06 09:17:19] a...@php.net

I'm not sure what you're trying to do in that script, but i suppose it's a bug 
in 
it. You convert from local to GMT and then again. I cannot repro neither with 
your 
script nor with a much smaller sample

putenv('TZ=Africa/Cairo');
echo date('l g:i A');

Do that two lines work for you?

------------------------------------------------------------------------
[2013-07-06 02:08:21] easysurf at easysurf dot cc

<?php

function recity($anycity) {

$lcity1 = strlen($anycity);
$pos1 = strpos($anycity, "/");
$pos1 = $pos1 + 1;
$sstrt1 = $lcity1 - $pos1;
$tncity = substr($anycity, $pos1, $sstrt1);
$tncity2 = "";
for ($i = 0, $j = strlen($tncity); $i <= $j; $i++) {
if (substr($tncity, $i, 1) == "_") {
$tncity2 = $tncity2 . " ";
        }
else {
$tncity2 = $tncity2 . substr($tncity, $i, 1);
        }
}

return $tncity2;
}

$time1 = date("g:i A", mktime());
$city1 = "GMT";
$city2 = "Africa/Cairo";

$ncity1 = recity($city1);
$ncity2 = recity($city2);

    $start_time_input = $time1;
    $start_tz = $city1;
    $end_tz = $city2;
    putenv("TZ=$start_tz");
    $start_time = strtotime($start_time_input);
    echo "<p><strong>";
    echo "<BR /><br />";
    echo "<BLOCKQUOTE><FONT SIZE=6>";
    putenv("TZ=$end_tz");
    echo date("l g:i A",$start_time)."\n";
    echo "</strong>";
    echo " in $ncity2.</p>";
    echo "</FONT></BLOCKQUOTE>";
    echo "<BR /><br />";
    echo "<P>return to <A HREF=http://www.easysurf.cc/tmnw4.htm>What Time is it 
now?</A><P>";

?>

------------------------------------------------------------------------
[2013-07-05 07:14:03] a...@php.net

Please post a small PHP code snippet and date related INI directives.

------------------------------------------------------------------------
[2013-07-05 00:23:37] easysurf at easysurf dot cc

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>What Time is it Now - Select a Location</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFAF0" TEXT=#000000 LINK="Blue" VLINK="#0000A0" ALINK="Blue" >
<form action="http://easysurf.onlinewebshop.net/php2/tmzn.php"; method="post">
<CENTER>
<TABLE>
<TR><TH>Select a Location</TH></TR>
<TR><TD>
<select class=debu3 name="city2">
<option value="Africa/Cairo">Cairo</option>
        </select> 
</TD></TR></TABLE>
<BR>
<input type="submit" name="submit" value="Click to Calculate" />
</CENTER>
</form>

</BODY></HTML>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65201


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65201&edit=1

Reply via email to