For some reason, Javascript I am trying to execute with php is not working.
Below is my code.
<script type="text/javascript">
function GetIst() {
var d = new Date()
var gmtHours = -d.getTimezoneOffset();
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 minutes",strtotime($row["sch_time"])));
}
?>
For some reason below code does work.
<?php
$time_current = "<script language=javascript>GetIst();</script>";
echo "". $time_current;
?>