HTML Display Current date

前端 未结 6 1487
日久生厌
日久生厌 2021-02-02 13:19

I am using website builder called \'clickfunnels\', and they don\'t support feature that would allow me to display current date. But, I can add custom html to it.

I was

6条回答
  •  野的像风
    2021-02-02 13:37

    Here's one way. You have to get the individual components from the date object (day, month & year) and then build and format the string however you wish.

    n =  new Date();
    y = n.getFullYear();
    m = n.getMonth() + 1;
    d = n.getDate();
    document.getElementById("date").innerHTML = m + "/" + d + "/" + y;

提交回复
热议问题