因為間中要用到每次都要去 Stack Overflow 抓有點麻煩所以就直接記下來了:
new Date().toLocaleDateString()
> 2022/1/30
new Date().toLocaleString(undefined, {year: 'numeric', month: '2-digit', day: '2-digit', weekday:"long", hour: '2-digit', hour12: false, minute:'2-digit', second:'2-digit'})
> 2022年01月30日 星期日 01:05:48
new Date().toLocaleDateString('en-US', {year: 'numeric', month: '2-digit', day: '2-digit'})
> 01/30/2022
new Date().toLocaleDateString('en-ZA')
> 2022/01/30
new Date().toLocaleDateString('en-CA')
> 2022-01-30
new Date().toLocaleString("en-US", {timeZone: "America/New_York"})
> 1/29/2022, 12:05:48 PM
new Date().toLocaleString("en-US", {hour: '2-digit', hour12: false, timeZone: "America/New_York"})
> 12