Formatting a date takes 1 line of code in PHP but it takes so many lines in JavaScript, at least in old answers.
Is there a new way of going from a variable myDate
containing "Mon Apr 20 2020 14:45:34 GMT+0100 (British Summer Time)" to "2020-04-20" in just 1 or 2 lines of code?
Format should be the same across locales so toLocaleDateString() isn't an option.