JavaScript中的toLocaleDateString()方法使用简介
JavaScriptDate.toLocaleDateString()方法的日期转换为字符串,使用操作系统的语言环境的约定返回“日期”部分。
语法
Date.toLocaleDateString()
下面是参数的详细信息:
- NA
返回值:
返回使用操作系统的语言环境的约定的“日期”部分。
例子:
<html> <head> <title>JavaScripttoLocaleDateStringMethod</title> </head> <body> <scripttype="text/javascript"> vardt=newDate(1993,6,28,14,39,7); document.write("FormatedDate:"+dt.toLocaleDateString()); </script> </body> </html>
这将产生以下结果:
FormatedDate:Wednesday,July28,1993