无涯教程-Javascript - toUTCString()函数

37 阅读1分钟

此方法转换为UTC字符串。

toUTCString() - 语法

Date.toTimeString ()

toUTCString() - 返回值

转换后的日期返回为UTC字符串。

toUTCString() - 示例

<html>
   <head>
      <title>JavaScript toUTCString Method</title>
   </head>
   
   <body>      
      <script type="text/javascript">
         var dateobject=new Date(1993, 6, 28, 14, 39, 7);
         document.write( dateobject.toUTCString() ); 
      </script>     
   </body>
</html>

运行上面代码输出

Wed, 28 Jul 1993 09:09:07 GMT

参考链接

www.learnfk.com/javascript/…