SOURCE

	function parseDateyyyyMMdd(str) {
	    if(!/^(\d){8}$/.test(str)) return "invalid date";
	    var y = Number(str.substr(0,4)),
	        m = Number(str.substr(4,2))-1, // Date 接受月份数值0~~11
	        d = Number(str.substr(6,2));
	    return new Date(y,m,d,9);
	}

    dateStr1 = '20210131'
    date1= parseDateyyyyMMdd(dateStr1)
    console.log('Local Time, date1=',date1.toLocaleString())
    
    console.log('UTC Time, date1=',date1.toUTCString())
console 命令行工具 X clear

                    
>
console