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的類方法,用于獲取當(dāng)月的當(dāng)前日期。
It accepts nothing as the parameter and returns a value between 1 to 31 (based on the day of the month).
它不接受任何內(nèi)容作為參數(shù),并返回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()方法獲取當(dāng)月的當(dāng)前日期
<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 日期間隔
總結(jié)
以上是生活随笔為你收集整理的getdate 日期间隔_日期getDate()方法以及JavaScript中的示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 如何评价索尼Z5?
- 下一篇: include函数_include()函