AI编程助手
AI免费问答

如何使用通用时间约定将日期转换为字符串?

王林   2023-08-19 19:29   1570浏览 转载

如何使用通用时间约定将日期转换为字符串?

使用通用时间约定将日期转换为字符串,可以使用toUTCString()方法。它返回将日期转换为字符串,使用通用时间约定。

示例

您可以尝试运行以下代码,了解如何使用UTC将日期转换为字符串:

   
      <title>JavaScript toUTCString Method</title>
   
   
      <script>
         var dateobject = new Date(2018, 0, 15, 14, 39, 7);
         document.write( dateobject.toUTCString() );
      </script>
   
声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除