How to get current date in jquery?

前端 未结 30 1901
春和景丽
春和景丽 2020-11-27 09:51

I want to know how to use the Date() function in jQuery to get the current date in a yyyy/mm/dd format.

30条回答
  •  醉酒成梦
    2020-11-27 09:58

    I know I am Late But This Is All You Need

    var date = (new Date()).toISOString().split('T')[0];
    

    toISOString() use built function of javascript.

    cd = (new Date()).toISOString().split('T')[0];
    console.log(cd);
    alert(cd);

提交回复
热议问题