The front end Js date conversion to standard format January 3, 2024 by 欒俊傑 No Comments var date = new Date(a);var y = date.getFullYear(); var m = date.getMonth() + 1; m = m < 10 ? '0' + m : m; var d = date.getDate(); console.log(y + The '-' + m + The '-' + d); Copy the code Eg: 2021-06-10