扫码一下
查看教程更方便
tolocaletimestring() 方法可根据本地时间把 date 对象的时间部分转换为字符串,并返回结果。
tolocaletimestring 方法在格式化日期方面依赖于基础操作系统。它使用运行脚本的操作系统的格式约定将日期转换为字符串。
该方法的语法如下:
date.tolocaletimestring()
无
date object 的时间部分的字符串表示,以本地时间区表示,并根据本地规则格式化。
所有主要浏览器都支持 tolocaletimestring() 方法
javascript tolocaletimestring method
输出结果:
formated date : 2:39:07 pm