new Date().toLocaleTimeString()

function tick() {
  const element = (
    

Hello, world!

It is {new Date().toLocaleTimeString()}.

); ReactDOM.render( element, document.getElementById('root') ); } setInterval(tick, 1000);

new Date().toLocaleTimeString() 返回本地时间字符串

所有Date()对象方法参考:

http://www.runoob.com/jsref/jsref-obj-date.html

你可能感兴趣的:(new Date().toLocaleTimeString())