I am currently using the below code which is not working.
<script type="text/javascript">
function GetIst() {
var d = new Date()
var gmtHours = -d.getTimezoneOffset()*60;
document.write(+ gmtHours);
}
</script>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mysql2", $con);
$reminder = "<script language=javascript>GetIst();</script>";
$currentdate = date("Y-m-d");
$res = mysql_query("SELECT * FROM schedule WHERE sch_date >= '$currentdate' ORDER BY timestmp ASC limit 20");
while ( $row = mysql_fetch_array($res) ) {
echo '<br />'.date('H:i', strtotime("+$reminder seconds",strtotime($row["sch_time"])));
}
?>
It gives all times as 00:00. It should be like 12:30 or 04:30
But when excecute below it does work.
<?php
$time_current = "<script language=javascript>GetIst();</script>";
echo "". $time_current;
?>
Now, I cannot use the second code because I also need to offset time for client time zone.
What I believe error could be at
echo '<br />'.date('H:i', strtotime("+$reminder seconds",strtotime($row["sch_time"])));
Help would be appreciated.