Latest web development tutorials

JavaScript toDateString () method

Date Object Reference JavaScript Date Object

Examples

The date portion of a Date object to a readable string:

var d = new Date();
var n = d.toDateString();

n outputs the result:


try it"

Definition and Usage

toDateString () method to convert the date portion of a Date object to a string and returns the result.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support toDateString () method


grammar

Date.toDateString()

return value

Type 描述
String 日期作为字符串输出。


Date Object Reference JavaScript Date Object