Site Notice

hello, world

Difference between revisions of "Time"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
 
([InPageEdit] 没有编辑摘要)
Line 1: Line 1:
<span onclick="$(this).text(time())"></span>
+
<span onclick="$(this).text(time())">time</span>
 
<html><script>function time() {
 
<html><script>function time() {
 
  var now = new Date(),
 
  var now = new Date(),

Revision as of 14:28, 5 January 2020

time <html><script>function time() {

var now = new Date(),
         y = now.getFullYear(), m = Number(now.getMonth() + 1), d = Number(now.getDate());
         if (m < 10) m = '0' + m;
         if (d < 10) d = '0' + d;
         var time = y + '-' + m + '-' + d;
 return time;

} </script> </html>