基础知识

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > 基础知识 > JavaScript中的Date.toSource()方法

JavaScript中Date.toSource()方法的使用教程

投稿:goldensun

这篇文章主要介绍了JavaScript中Date.toSource()方法的使用教程,用来返回日期为字符串,是JS入门学习中的基础知识,需要的朋友可以参考下

 此方法返回表示对象的源代码的字符串。

注:此方法可能不会在类IE的所有浏览器上正常工作。
语法

Date.toSource()

下面是参数的详细信息:

返回值:

例子:

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

这将产生以下结果:

Formated Date : (new Date(743850547000))

您可能感兴趣的文章:
阅读全文