JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Date.toLocaleString() Method

Name

Date.toLocaleString() Method---convert a Date to a string

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

date.toLocaleString()

Arguments

none

Returns

A string representation of the date and time specified by the Date object date. The date and time are represented in the local time zone.

Usage

toLocaleString() converts a date to a string, using the local time zone. This method also uses local conventions for date and time formatting, so the format may vary widely platform to platform, and also country to country. This method returns a string formatted in what is likely the user's preferred date and time format. Because the format may vary widely, this method is not useful when the date string must be passed to a CGI script or otherwise machine processed.

Use Date.toGMTString() to convert a date to a string using the GMT time zone and a more standard format.

See Also

"Date", "Date.parse()", "Date.toGMTString()"


Previous Home Next
Date.toGMTString() Book Index Date.UTC()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
Hosted by uCoz