const time = Temporal.PlainTime.from("12:34:56");
console.log(time.toLocaleString()); // 12:34:56 PM (assuming en-US locale)Temporal.PlainTime.prototype.toLocaleString()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const time = Temporal.PlainTime.from("12:34:56");
time.toLocaleString("en-US", { timeStyle: "short" }); // 12:34 PM
time.toLocaleString("en-US", { hour: "2-digit" }); // 12 PM