I'm trying to find out the difference between 2 dates. Can someone tell me why my second text field is empty? It's not finding the difference for some reason.
<script language="javascript">
function currentdate(){
var the_date = new Date();
document.luck.today.value=the_date;
}
function duedate(the_date){
var nowsec = now.getTime();
var doomsday=new Date(2000, 00, 01, 00, 00, 00);
var thensec = doomsday.getTime();
var ans = (thensec - nowsec) /1000 /60 /60 /24;
document.luck.daystill.value=ans;
}
</script>
Today's date: <input type="text" name="today">
Remaining time until the contest is over: <input type="text" name="daystill">
<script language="javascript">
function currentdate(){
var the_date = new Date();
document.luck.today.value=the_date;
}
function duedate(the_date){
var nowsec = now.getTime();
var doomsday=new Date(2000, 00, 01, 00, 00, 00);
var thensec = doomsday.getTime();
var ans = (thensec - nowsec) /1000 /60 /60 /24;
document.luck.daystill.value=ans;
}
</script>
Today's date: <input type="text" name="today">
Remaining time until the contest is over: <input type="text" name="daystill">