The Ultimate Khmer Date Utility
The easiest way to handle
Khmer & Lunar Dates.
Stop struggling with complex calendar logic. Easily format local times, calculate precise Lunar phases, and predict the exact moment of the Khmer New Year with a single, elegant library.
$
npm i @pphatdev/format-datetime Live Timekm-KH
Loading...
Lunar Date
Loading...
Khmer New Year Calculator
Loading...
Target Year:
Quick Start Guide
1. Basic Formatting
Format any standard JavaScript Date object into localized strings using familiar tokens.
import{ FormatDateTime }from'@pphatdev/format-datetime';constdate =newDate();constformatted =FormatDateTime.format(date,'DD MMMM YYYY','km');// Result: "០១ មករា ២០២៤"
2. Lunar Date Conversion
Instantly convert Gregorian dates into the traditional Khmer Lunar calendar system.
import{ FormatDateTime }from'@pphatdev/format-datetime';constdate =newDate();constlunar =FormatDateTime.getLunarDate(date);// Result: "ថ្ងៃចន្ទ ទី១ ខែមករា ឆ្នាំរោង ឆស័ក ព.ស. ២៥៦៨"
3. Khmer New Year Calculation
Calculate the exact time and date of the Khmer New Year (Moha Sangkran) for any given year.
import{ FormatDateTime }from'@pphatdev/format-datetime';constkny =FormatDateTime.getKhmerNewYear(2024);console.log(kny);/* Result: {date: "2024-04-13T15:17:00.000Z", lunarDate: "ថ្ងៃសៅរ៍ ទី៥ ខែចេត្រ ឆ្នាំរោង ឆស័ក ព.ស. ២៥៦៨", angel: "មហោធរៈទេវី"}*/
Interactive Playground
Try:
Standard Tokens
YYYY Year
MMMM Month
DDDD Day
dd Date
hh 12 Hour
HH 24 Hour
mm Minute
ss Second
A AM/PM
Lunar Tokens
BBBB BE Year
JJJJ JS Year
lA Animal
lE Sak
lM Month
ld Day Num
lN Phase
lW Weekday
Live Output
...
