資料載入中

胡言亂語

JavaScript 取得今天日期

JavaScript 使用 Date() 來取得時間的資訊。

再使用指令如 getDate()、getMonth()、getFullYear() 分別來取得日、月、年結果如下:
var Today=new Date();
document.write("今天日期是 " + Today.getFullYear()+ " 年 " + (Today.getMonth()+1) + " 月 " + Today.getDate() + " 日");

參考網址連結網址

以上紀錄~
 

  • JavaScript 取得時間資訊的方法
  • 使用 Date() 取得當前日期
  • 使用 getDate() 獲取當前日
  • 使用 getMonth() 獲取當前月份
  • 使用 getFullYear() 獲取當前年份
https://innstory.com/story-JavaScript取得今天日期-1906

上一篇
 使用jQuery阻止input直接按Enter就送出表單

下一篇
利用htaccess隱藏副檔名html和php 

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

mysql 查詢數據資料是否有重複

mysql 查詢數據資料是否…

Mark Chang 8 年又 12 天 2.4K

有沒有試過資料庫裡上萬筆資料卻不知道是不是有重複的數據? 這時你一定要試試這個查詢方法~  

Android UI設計距離課題

Android UI設計距離…

Mark Chang 7 年又 195 天 2.3K

layoutmarginTop指定該屬性所在控件距離上方的位置空間。 layoutmarginBot...

將Google字型fonts.googleapis.com新增到CSP header 中

將Google字型fonts…

Mark Chang 4 年又 282 天 1.8K

Content Security Policy (CSP) 內容安全政策 主要用來限制網頁中對外部...