21/01/2026
အားလုံးပဲ မင်္ဂလာပါ။
ဒီတစ်ပတ်မှာတော့ JavaScript ထဲက Date Time Format အမျိုးမျိုးကို ပြောင်းပုံကို မျှဝေပေးသွားမှာ ဖြစ်ပါတယ်။ Date Time Format တွေဆိုတာ UI မှာရော၊ System Ajax တွေအတွက်ပါ မရှိမဖြစ် အသုံးပြုနေကြတဲ့ အပိုင်းပဲ ဖြစ်ပါတယ်။
const date = new Date("2026-01-21T13:30:00Z");
TZ ဆိုတာကတော့ TimeZone ပဲ ဖြစ်ပါတယ်။
const now = new Date();
ဒီနေ့ ရက်စွဲကို ရယူခြင်း ဖြစ်ပါတယ်။
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timeZone);
Time Zone ကို ရယူခြင်း ဖြစ်ပါတယ်။
const formatted = now.toLocaleString("en-US", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZoneName: "short"
});
Output: 01/21/2026, 09:30:00 PM GMT+8
now.toISOString()
Output: 2026-01-21T13:30:00.000Z
const readableFormat = date.toLocaleString("en-GB", {
day: "2-digit",
month: "short",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
hour12: false,
timeZone: "UTC"
});
Output: 21 Jan 2026, 13:30
const sqlFormat = date
.toISOString()
.slice(0, 19)
.replace("T", " ");
Output: 2026-01-21 13:30:00
14/01/2026
07/01/2026
02/01/2026
26/12/2025
24/12/2025
10/12/2025
05/12/2025
03/12/2025
28/11/2025
26/11/2025