當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
getdate 日期间隔_日期getDate()方法以及JavaScript中的示例
生活随笔
收集整理的這篇文章主要介紹了
getdate 日期间隔_日期getDate()方法以及JavaScript中的示例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
getdate 日期間隔
JavaScript Date getDate()方法 (JavaScript Date getDate() method)
getDate() method is a Date's class method and it is used to get the current day of the month.
getDate()方法是Date的類方法,用于獲取當月的當前日期。
It accepts nothing as the parameter and returns a value between 1 to 31 (based on the day of the month).
它不接受任何內容作為參數,并返回1到31之間的值(基于月中的日期)。
Syntax:
句法:
var dt = new Date();dt.getDate();Examples:
例子:
Input:var dt = new Date();dt.getDate();Output:4 // if date is 04/any month/any yearJavaScript code to get the current day of the month using getDate() method
JavaScript代碼使用getDate()方法獲取當月的當前日期
<html> <head><title>JavaScipt Example</title></head><body> <script>var dt = new Date(); //Date constructor var date = dt.getDate(); //getting day of the month//printing daydocument.write("Today's date is: " + date); </script> </body> </html>Output
輸出量
Today's date is: 4翻譯自: https://www.includehelp.com/code-snippets/date-getDate-method-with-example-in-javascript.aspx
getdate 日期間隔
總結
以上是生活随笔為你收集整理的getdate 日期间隔_日期getDate()方法以及JavaScript中的示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何评价索尼Z5?
- 下一篇: include函数_include()函