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

如何緩存靜態資源使用HTTP緩存

如何緩存靜態資源使用HTTP...

配置服務器以返回CacheControlHTTP響應標頭: CacheControl: maxage...

讓文字左右對齊

讓文字左右對齊

讓文字左右對齊這類的設計案,通常都會出現在平面設計居多。 網頁上很少會遇到客戶會執著於這方面,但不能...

如何將mysql table auto_increment重設

如何將mysql table...

photo555 資料表裡的資料加加減減,一不小心突然驚覺當初的欄位長度設定的不夠⊙⊙ 當然,你可以...

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