如何使用通用时间转换将日期转换成字符串?
要使用通用时间转换将日期转换成字符串,请使用 toUTCString() 方法。使用通用时间转换,该方法会将日期转换成字符串并返回。
示例
可以尝试运行以下代码来了解如何使用 UTC 将日期转换成字符串−
<html> <head> <title>JavaScript toUTCString Method</title> </head> <body> <script> var dateobject = new Date(2018, 0, 15, 14, 39, 7); document.write( dateobject.toUTCString() ); </script> </body> </html>
广告