javascript - 如何使用 .toLocaleDateString() 以 2020 年 10 月 29 日等格式显示日期以供 en-us 使用?
问题描述
我不确定如何重新排列从 .toLocaleDateString() 显示的日期顺序。
thisDate.toLocaleDateString('en-us', { year: 'numeric', day: '2-digit', month: 'short', hour: 'numeric', minute: 'numeric', hour12: true });
我尝试重新排列期权订单,但似乎没有任何东西可以重新排列订单,所以无论我希望它显示 2020 年 10 月 29 日时做什么,我都会得到 2020 年 10 月 29 日。
解决方案
尝试使用en-GB
语言环境
const date = new Date().toLocaleDateString('en-GB', { year: 'numeric', day: '2-digit', month: 'short' });
console.log(date)