Home > Web Front-end > JS Tutorial > body text

JavaScript中的toLocaleDateString()方法使用简介_基础知识

WBOY
Release: 2016-05-16 15:55:29
Original
1488 people have browsed it

 JavaScript Date.toLocaleDateString()方法的日期转换为字符串,使用操作系统的语言环境的约定返回“日期”部分。
语法

Date.toLocaleDateString()

Copy after login

下面是参数的详细信息:

  • NA

返回值:

返回使用操作系统的语言环境的约定的“日期”部分。
例子:

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

Copy after login

这将产生以下结果:

Formated Date : Wednesday, July 28, 1993 

Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!