Edit report at https://bugs.php.net/bug.php?id=65201&edit=1
ID: 65201
User updated by: easysurf at easysurf dot cc
Reported by: easysurf at easysurf dot cc
Summary: Africa/Cairo time off by 1 hour
-Status: Feedback
+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:
<?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>";
?>
Previous Comments:
------------------------------------------------------------------------
[2013-07-05 07:14:03] [email protected]
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>
------------------------------------------------------------------------
[2013-07-04 06:39:58] [email protected]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Please post also all the datetime related ini options you have.
------------------------------------------------------------------------
[2013-07-04 00:32:35] easysurf at easysurf dot cc
Description:
------------
Africa/Cairo timezone is off by one hour.
Expected result:
----------------
If it is 10:00 am in Cairo it should not say 11:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65201&edit=1