We would like to know how to compare date/time now against yyyy/mm/dd hh:mm:ss.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!-- w ww . j a v a 2 s .c o m-->
$('#editDate').val("2013/01/19 22:46:01");
$('#showit').click(function(){
var testDate = $('#editDate').val();
var d = new Date;
$('#result').html(d);
$('#result2').html(testDate);
if (Date.parse(d)<Date.parse(testDate)) {
document.writeln(d+' minus than '+testDate);}
else{
document.writeln(d+' more than '+testDate);
}
});
});
</script>
</head>
<body>
<input id="editDate" type="text" />
<button id="showit">Test</button>
<div id="result"></div>
<div id="result2"></div>
</body>
</html>
The code above is rendered as follows: