js 獲取當前時間


// 獲取當前日期時間
function getNowTimeFull(){
var myDate=new Date;
var year=myDate.getFullYear(); //獲取當前年
var mon=myDate.getMonth()+1<10?"0"+(myDate.getMonth()+1):myDate.getMonth()+1; //獲取當前月
var date=myDate.getDate()<10?"0"+myDate.getDate():myDate.getDate(); //獲取當前日
var hour=myDate.getHours()<10?"0"+myDate.getHours():myDate.getHours();//獲取當前時
var minute=myDate.getMinutes()<10?"0"+myDate.getMinutes():myDate.getMinutes();//獲取當前分
return year+"-"+mon+"-"+date+" "+hour+":"+minute+":00";
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM