var start_date;
var end_date;
console.log("生效时间"+start_date+"失效时间"+end_date)
var start_year = new Date(start_date).getFullYear;
var start_month =new Date(start_date).getMonth;
var start_day = new Date(start_date).getDate;
var end_year = new Date(end_date).getFullYear;
var end_month =new Date(end_date).getMonth;
var end_day = new Date(end_date).getDate;
console.log("1.年月日"+start_year+start_month+start_day+"2.年月日"+end_year+end_month+end_day)
控制台输出结果如下
生效时间2023-05-01 00:00:00.0失效时间2023-05-06 00:00:00.0
1.年月日function getFullYear() { [native code] }function getMonth() { [native code] }function getDate() { [native code] }2.年月日function getFullYear() { [native code] }function getMonth() { [native code] }function getDate() { [native code] }
我试了var start_year = new start_date.getFullYear;这么写,输出结果是undefind。
我想知道,在给了时间的情况下,怎么获得他的年月日?