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

How to use javascript date method

藏色散人
Release: 2021-10-18 15:27:11
Original
2781 people have browsed it

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()
Copy after login

Example

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

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

Output:

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template