Loading...

javascript獲取當前時間

Temperature: 0 °C

Mark ChangMark Chang
author_tools


javascript獲取當前時間

var myDate = new Date();
//獲取當前年
var year=myDate.getFullYear();
//獲取當前月
var month=myDate.getMonth()+1;
//獲取當前日
var date=myDate.getDate();
var h=myDate.getHours(); //獲取當前時(0-23)
var m=myDate.getMinutes(); //獲取當前分(0-59)
if(m<10) m = '0' + m;
var s=myDate.getSeconds();
if(s<10) s = '0' + s;
var now=year+'-'+month+"-"+date+" "+h+':'+m+":"+s;


以上紀錄~

https://innstory.com/story-javascript獲取當前時間-1685
javascript

Prev
 分享_一隻一塊錢!泰勞興奮狂抓荔枝椿象 大讚:超級好吃

Next
破版很醜 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

RPO(Relative Path Overwrite)相對路徑覆蓋攻擊

RPO(Relative P...

首先,先來用例子說明何謂「相對路徑」何謂「絕對路徑」。 例如你有一個網址為http://www.de...

CSSobject-fit 屬性用於指定應如何調整 img或video的大小以適合其容器

CSSobject-fit ...

在UI排版時常會遇到一個問題,後台上傳的圖片比例無法符合前台顯示的DIV容器。 以前我比較常用的方式...

Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 12288 bytes) in

Fatal error: A...

今天在客戶的網站系統上發現了一個問題。 在上傳檔案時發生了一個錯誤: Fatal error: Al...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format