You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
export function getNowFormatDate() {
|
|
|
|
var date = new Date();
|
|
|
|
var seperator1 = "-";
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var month = date.getMonth() + 1;
|
|
|
|
var strDate = date.getDate();
|
|
|
|
if (month >= 1 && month <= 9) {
|
|
|
|
month = "0" + month;
|
|
|
|
}
|
|
|
|
if (strDate >= 0 && strDate <= 9) {
|
|
|
|
strDate = "0" + strDate;
|
|
|
|
}
|
|
|
|
var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
|
return currentdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getNowFormatTime(){
|
|
|
|
var now = new Date();
|
|
|
|
var hour = now.getHours();//得到小时
|
|
|
|
var minu = now.getMinutes();//得到分钟
|
|
|
|
var sec = now.getSeconds();//得到秒
|
|
|
|
if (hour < 10) hour = "0" + hour;
|
|
|
|
if (minu < 10) minu = "0" + minu;
|
|
|
|
if (sec < 10) sec = "0" + sec;
|
|
|
|
var time = "";
|
|
|
|
time = hour + ":" + minu + ":" + sec;
|
|
|
|
return time;
|
|
|
|
}
|