Pages

2 Aug 2013

Get current datetime in jquery


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get Current Datetime in JQuery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
var param1 = new Date();
var param2 = param1.getDate() + '/' + (param1.getMonth()+1) + '/' + param1.getFullYear() + ' ' + param1.getHours() + ':' + param1.getMinutes() + ':' + param1.getSeconds();
$('#lbltxt').text(param2)
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<label id="lbltxt"/>
</div>
</form>
</body>
</html>

No comments:

Post a Comment