您的位置:58编程 > javascript tolocalestring JavaScript toLocaleString() 方法

javascript tolocalestring JavaScript toLocaleString() 方法

2023-05-25 06:33

javascript tolocalestring JavaScript toLocaleString() 方法

javascript tolocalestring JavaScript toLocaleString() 方法

javascript tolocalestring

JavaScript toLocaleString() 方法

Date 对象参考手册 JavaScript Date 对象

实例

根据本地时间把 Date 对象转换为字符串:

var d=new Date();
var n=d.toLocaleString();

n 输出结果:

var d=new Date(); document.write(d.toLocaleString());


定义和用法

toLocaleString() 方法可根据本地时间把 Date 对象转换为字符串,并返回结果。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持toLocaleString() 方法


语法

Date.toLocaleString()

返回值

Type 描述
String 日期和时间以字符串形式输出。

技术细节

JavaScript 版本: 1.0


Date 对象参考手册 JavaScript Date 对象

阅读全文
以上是58编程为你收集整理的javascript tolocalestring JavaScript toLocaleString() 方法全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 58编程 58biancheng.com 版权所有 联系我们
桂ICP备12005667号-32 Powered by CMS