目录

toLocaleString()

JavaScript date toLocaleString()方法使用操作系统的本地约定将日期转换为字符串。

toLocaleString方法依赖于格式化日期的底层操作系统。 它使用运行脚本的操作系统的格式约定将日期转换为字符串。 例如,在美国,月份出现在日期(04/15/98)之前,而在德国,日期出现在月份之前(15.04.98)。

语法 (Syntax)

Date.toLocaleString ()

返回值 (Return Value)

以字符串格式返回格式化日期。

例子 (Example)

var dt = new Date(1993, 6, 28, 14, 39, 7); 
console.log( "Formated Date : " + dt.toLocaleString() );         

输出 (Output)

Formated Date : 7/28/1993, 2:39:07 PM          
↑回到顶部↑
WIKI教程 @2018