一、今日学习
<script>
//年月日
function getYMD(sep){
//实例化对象
let date=new Date();
//获取年月日
let y =date.getFullYear();
let m =date.getMonth()+1;
let d =date.getDate();
console.log(y,m,d);
// let ymd=''+y+sep+m+sep+d;
let ymd=[y,full0(m),full0(d)].join(sep);
return ymd;
}
//时分秒
function getHMS(sep1){
//实例化对象
let date=new Date();
//获取年月日
let h =date.getHours();
let mis =date.getMinutes();
let s =date.getSeconds();
console.log(h,mis,s);
// let ymd=''+y+sep+m+sep+d;
let hms=[h,mis,s].join(sep1);
return hms;
}
// 补零函数
function full0(n){
let rst=0;
if(n<10){
rst="0"+n;
}
else{
rst=n;
}
return rst;
}
//将年月日和时分秒进行拼接
function getfulltime(sep,sep1){
return getYMD(sep)+" "+getHMS(sep1);
}
console.log(getfulltime("/",":"))
</script>
2.考试
3.制作一个律师事务所页面
二、今日问题
无
三、解决方法
多级多练
|