JavaScript Date() 日期與時間
| Method | Description |
|---|
| getDate() | Get the day as a number (1-31) |
| getDay() | Get the weekday as a number (0-6) |
| getFullYear() | Get the four digit year (yyyy) |
| getHours() | Get the hour (0-23) |
| getMilliseconds() | Get the milliseconds (0-999) |
| getMinutes() | Get the minutes (0-59) |
| getMonth() | Get the month (0-11) |
| getSeconds() | Get the seconds (0-59) |
| getTime() | Get the time (milliseconds since January 1, 1970) |
| var thisDATE = Date.now() | |
| var thisDATE = new Date().getTime() | |
| var utcDate = new Date(Date.UTC(96, 11, 1, 0, 0, 0)); | |
| var nowDATE = Date(); | |
| var nowYear = new Date().getFullYear()+"年"; | |
| var nowMonth = new Date().getMonth()+1+"月"; | |
| var nowDate = new Date().getDate()+"日"; | |
var nowDay = days[ new Date().getDay() ]; var days = ["星期日","星期一,"星期二","星期三","星期四","星期五","星期六"]; | |
| var nowHours = new Date().getHours()+"時"; | |
| var nowMinutes = new Date().getMinutes()+"分"; | |
| var nowSeconds = new Date().getSeconds()+"秒"; | |
script getDate(), script getDay(),script getFullYear(),script getHours(),script getMilliseconds(),script getMinutes(),script getMonth(),script getSeconds(),script getTime(), script Date.now(), script new Date() ,script UTC()
沒有留言:
發佈留言