When I use getDate() in my php file, I always get time that lies 5 hours behind system time. So I use JavaScript getting time from system. My code is below
<script type="text/javascript">
Date.prototype.today = function () {
return ((this.getDate() < 10)?"0":"") + this.getDate() +"."+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"."+ this.getFullYear();
}
Date.prototype.timeNow = function () {
return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
}
var newDate = new Date();
var datetime = newDate.today() + " " + newDate.timeNow();
document.write(datetime);
</script>
It's a php file. Now I wanna use "datatime" in my php code
<?php
//Here I use datetime
?>
how do I use it? Thanks in advance.