目录

toLocaleFormat()

描述 (Description)

Javascript date toLocaleFormat()方法使用指定的格式将日期转换为字符串。

Note - 此方法可能与所有浏览器不兼容。

语法 (Syntax)

其语法如下 -

Date.toLocaleFormat()

参数细节 (Parameter Details)

formatString - C中strftime()函数所需格式的格式字符串。

返回值 (Return Value)

返回格式化日期。

例子 (Example)

请尝试以下示例。

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

输出 (Output)

Formated Date : Wed Jul 28 1993 14:39:07 GMT+0530 (India Standard Time)
↑回到顶部↑
WIKI教程 @2018