Dear All
First I'm trying to get the Client Date & Time using JavaScript.
After that I'm passing the JavaScript Variable to the PHP Variable (Which Im not sure is the right way).
When I echo the JavaScript Variable It displays.
But the problem is the the variable $dor consists of <script langauge="JavaScript"> document.write (da) </script> I just want the value of javascript variable da. Im stuck, How to pass a value of JavaScript variable into a PHP variable.
Please Help 🙁
See code below
<script language="JavaScript">
var mydate=new Date();
var temp=mydate.getMonth()+1
var da;
document.write("Todays date \t:\t");
var da = mydate.getDate() + "/" + temp + "/" + mydate.getYear();
document.write(da);
document.write("System time \t:\t");
document.write(mydate.getHours() + ":" + mydate.getMinutes() + ":" + mydate.getSeconds());
</script>
<?
$dor = "<script language=JavaScript> document.write(da) </script>";
echo $dor; // Displays the Date Of Client Side
//Coverting Date in to MySQL Format
echo "Original Date ".$dor;
$y = substr($dor, 6, 10);
$d = substr($dor, 0, 2);
$m = substr($dor, 3, 2);
echo "<br>Year ".$y;
echo "<br>Day ".$d;
echo "<br>Month ".$m;
$ndor = "$y-$m-$d";
echo "<br>New Date ".$ndor;
?>
---------------------------
Thanx a lot