資料載入中

胡言亂語

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 

發表留言

作者簡介

離不開電腦的宅男


推薦閱讀

作者其他相關類別故事

Font Awesome Icon Sizes

Font Awesome I…

Mark Chang 7 年又 297 天 1.8K

紀錄一下Font Awesome icon尺寸設定 參考網址

當XAMPP遇到VMWARE占用PORT 443導致無法啟動APACHE

當XAMPP遇到VMWARE…

Mark Chang 4 年又 317 天 2.3K

在使用XAMPP時,若系統有安裝 VMWare Workstation,VMWare會將 port ...

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

將Google字型fonts…

Mark Chang 4 年又 189 天 1.6K

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