Home >Web Front-end >Front-end Q&A >How to use javascript date method

How to use javascript date method

藏色散人
藏色散人Original
2021-10-18 15:27:112777browse

The javascript date method is used to return the date and time of the day. It uses statements such as "document.write(Date())" and the return value is China Standard Time.

How to use javascript date method

The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer

How to use the javascript date method?

Date() method returns the date and time of the current day.

Syntax

Date()

Example

In this example, we will output today’s date and time:

<script type="text/javascript">
document.write(Date())
</script>

Output:

Mon Oct 18 2021 15:24:44 GMT+0800 (中国标准时间)

Recommended learning: "javascript basic tutorial"

The above is the detailed content of How to use javascript date method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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