Skip to main content
Version: Next

Calendar time

formatCalendar gives chat-style timestamps: "Today at 3:00 PM", "Yesterday at …", "Last Monday at …", and the date for anything further away.

formatCalendar​

DistanceResult (en)
today / tomorrow / yesterdayToday at 3:00 PM
2 – 6 days aheadThursday at 3:00 PM
2 – 6 days ago, same weekWednesday at 3:00 PM
2 – 6 days ago, previous weekLast Wednesday at 3:00 PM
further3/4/2025 (locale yMd)

Change now or week starts in the dark bar to watch the wording switch between this week and last or next week.

LOADING…
⚙ TRY IT
⚡ OUTPUT

Today is Loading….

date.formatCalendar(clock: now, locale: 'en');

Week-aware wording​

Weekdays are worded relative to the current week, using the locale's first day of the week (or the configured one). Languages that say "this Monday" and "last Monday" differently use the right form:

LocaleSame weekOther week
enWednesday at 3:00 PMLast Wednesday at 3:00 PM
viThứ Tư lúc 15:00Thứ Tư tuần trước lúc 15:00
zh本周三15:00上周三15:00 · 下周一15:00
ja水曜日 15:00先週土曜日 15:00 · 来週月曜日 15:00
ruВ среду, в 15:00В прошлое воскресенье, в 15:00
ko수요일 15:00지난주 토요일 15:00 · 다음 주 월요일 15:00

Calendar strings exist for every supported locale; a custom locale without them uses English.