function NOW() { var date = new Date(); var aaaa = date.getFullYear(); var gg = date.getDate(); var mm = (date.getMonth() + 1); if (gg < 10) gg = "0" + gg; if (mm < 10) mm = "0" + mm; var cur_day = aaaa + "-" + mm + "-" + gg; var hours = date.getHours() var minutes = date.getMinutes() var seconds = date.getSeconds(); if (hours < 10) hours = "0" + hours; if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; return cur_day + " " + hours + ":" + minutes + ":" + seconds; } NOW(); // "2017-10-17 14:02:33"
You can include this feature on your web pages with our free CDN:
<script src="https://cdn.dotmaui.com/dotmaui/js/now.min.js"></script>
I uploaded this to my website but it didn’t work.
time.html create and copy in public.html file
http://www.mywebsite/time.html
time.html here:
function NOW() {
var date = new Date();
var aaaa = date.getFullYear();
var gg = date.getDate();
var mm = (date.getMonth() + 1);
if (gg < 10)
gg = "0" + gg;
if (mm < 10)
mm = "0" + mm;
var cur_day = aaaa + "-" + mm + "-" + gg;
var hours = date.getHours()
var minutes = date.getMinutes()
var seconds = date.getSeconds();
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
return cur_day + " " + hours + ":" + minutes + ":" + seconds;
}
but not working. why?
thank you very much
Hi kemal,
we tried the function and found no problems. Does it return any kind of error?