const count = 26254.39;
const date = new Date("2012-05-24");
function log(locale) {
console.log(
`${new Intl.DateTimeFormat(locale).format(date)} ${new Intl.NumberFormat(
locale,
).format(count)}`,
);
}
log("en-US"); // 5/24/2012 26,254.39
log("de-DE"); // 24.5.2012 26.254,39Intl / notebook
Intl
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const date = new Date("2012-05-24");
const formattedDate = new Intl.DateTimeFormat(navigator.language).format(date);const count = 26254.39;
const formattedCount = new Intl.NumberFormat(navigator.languages).format(count);