Server Side PHP Date convert in javascript format.
Javascript is a client side scripting language.So when we dealing with dates in javascript.Some time we need the current date of Server using javascript.So we can get a unix time stamp in PHP using strtotime() function in PHP
So following Script give you server Side Date and time in Javascript.
Example
<script type="text/javascript">
var ServerSide = <?=strtotime("now")?>;
var today = new Date(ServerSide * 1000);
alert(today);
</script>
output
Thanks for reading
No comments:
Post a Comment