DSP

几种获取当前时间的方法

2019-07-13 12:40发布

html> <html lang="en"> <head> <meta charset="UTF-8"> <script type="text/javascript" src="angular-1.3.0.js">script> <title>title> <script> var app = angular.module("timer", []); app.directive("nowTime", function () { return { restrict: "EACM", template: "

" + new Date().toLocaleDateString() + " " + new Date().toLocaleTimeString() + "

"
, replace: true } }); script> head> <body ng-app="timer"> <now-time>当前时间:now-time> <div now-time>当前时间:div> <div class="now-time">当前时间:div> body> html>