Date()
Date() is a JavaScript function in the Date category. Returns the current date and time as a string. The syntax is Date(). A typical example: Date() // "Thu Jun 06 2024 20:00:00 GMT+0800". A close sibling is Date.now(), which returns the current timestamp in milliseconds. A close sibling is Date.parse(), which parses a date string and returns the timestamp. A close sibling is Date.UTC(), which returns the timestamp from UTC parameters. A close sibling is Date.prototype.getFullYear(), which returns the year (4 digits). More about this category: Date methods for working with dates and times. Related Date methods: Date.now(), Date.parse(), Date.UTC(), Date.prototype.getFullYear(), Date.prototype.getMonth(), Date.prototype.getDate(), Date.prototype.getDay(), Date.prototype.getHours(). This page is part of the free JS Reference documentation covering 1027+ methods, each with syntax, parameters, return values, examples, and common pitfalls. You can try Date() immediately in the JavaScript playground, look up unfamiliar terms in the glossary, or return to the JS Reference homepage.