Why javascript getTime() is not a function?

前端 未结 4 1732
夕颜
夕颜 2020-12-29 18:31

I used the following function,

function datediff()
{
 var dat1 = document.getElementById(\'date1\').value;
 alert(dat1);//i get 2010-04-01
var dat2 = documen         


        
4条回答
  •  长情又很酷
    2020-12-29 19:08

    To use this function/method,you need an instance of the class Date .

    This method is always used in conjunction with a Date object.

    See the code below :

    var d = new Date();
    d.getTime();
    

    Link : http://www.w3schools.com/jsref/jsref_getTime.asp

提交回复
热议问题