Home >Web Front-end >Front-end Q&A >How to use javascript date method
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.
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!