我正在使用名为"clickfunnels"的网站构建器,但它们不支持允许我显示当前日期的功能.但是,我可以向其中添加自定义html.
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.
我想知道是否有人知道如何以dd/mm/yyyy格式显示网站当前日期
I was wondering if anyone knows how to show on website current date in format: dd/mm/yyyy
目前我已经尝试过:
<p id="date"></p> <script> document.getElementById("date").innerHTML = Date(); </script>这可行,但是它显示的日期是这样的:
And this works, but it displays date likes this:
2015年9月12日星期六格林尼治标准时间+0200(时区....)
Sat Sep 12 2015 16:40:10 GMT+0200 (Timezone.... )
推荐答案这是一种方法.您必须从日期对象(日,月和年)中获取各个组件,然后根据需要构建并设置字符串格式.
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; <p id="date"></p>
更多推荐
HTML显示当前日期
发布评论