PHPackages                             phannaly/php-datetime-khmer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phannaly/php-datetime-khmer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phannaly/php-datetime-khmer
===========================

The PHP library for convert datetime to Khmer

1.0.3(5y ago)1510.3k↓35.7%9MITPHP

Since Jan 20Pushed 5y ago3 watchersCompare

[ Source](https://github.com/phannaly/php-datetime-khmer)[ Packagist](https://packagist.org/packages/phannaly/php-datetime-khmer)[ RSS](/packages/phannaly-php-datetime-khmer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

The PHP libray for convert datetime into Khmer
==============================================

[](#the-php-libray-for-convert-datetime-into-khmer)

[![Actions Status](https://github.com/phannaly/php-datetime-khmer/workflows/Build/badge.svg)](https://github.com/phannaly/php-datetime-khmer/actions)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

This is a small package for converting datetime to Khmer language.

Requirements
------------

[](#requirements)

- PHP 7.0 or higher

Setup
-----

[](#setup)

You don't need to install by composer if your project doesn't have it.

Just import it manually in `src` folder.

But If you want to install by a composer, please follow the command below

```
composer require phannaly/php-datetime-khmer

```

Usage
-----

[](#usage)

Whenever you want to convert any DateTime into Khmer language, just wrap it inside method.

Firstly, you can import or instance class

```
use KhmerDateTime\KhmerDateTime;
```

You have to parse a valid string DateTime format and without a specific time, it will set time to 00:00

```
$dateTime = KhmerDateTime::parse('2019-05-22');

$dateTime->day(); // ២២
$dateTime->fullDay(); // ពុធ
$dateTime->month(); // ០៥
$dateTime->fullMonth(); // ឧសភា
$dateTime->year(); // ២០១៩
$dateTime->minute(); // ០០
$dateTime->hour(); // ០០
$dateTime->meridiem(); // ព្រឹក
$dateTime->week(); // ៤
$dateTime->fullWeek(); // សប្តាហ៍ទី៤
$dateTime->weekOfYear(); // ២១
$dateTime->fullWeekOfYear(); // សប្តាហ៍ទី២១
$dateTime->quarter(); // ២
$dateTime->fullQuarter(); // ត្រីមាសទី២
```

For example:

```
$dateTime = KhmerDateTime::parse('2020-09-20 12:40');
```

will producing result below

CodeFormatOutput`$dateTime->format("L")``L``២០/០៩/២០២០``$dateTime->format("LL")``LL``២០ កញ្ញា ២០២០``$dateTime->format("LLT")``LLT``២០ កញ្ញា ២០២០ ១២:៤០ ល្ងាច``$dateTime->format("LLL")``LLL``អាទិត្យ ២០ កញ្ញា ២០២០``$dateTime->format("LLLT")``LLLT``អាទិត្យ ២០ កញ្ញា ២០២០ ១២:៤០ ល្ងាច``$dateTime->format("LLLLT")``LLLL``ថ្ងៃអាទិត្យ ទី២០ ខែកញ្ញា ឆ្នាំ២០២០``$dateTime->format("LLLLT")``LLLLT``ថ្ងៃអាទិត្យ ទី២០ ខែកញ្ញា ឆ្នាំ២០២០ ១២:៤០ ល្ងាច`If you wanna use DateTime duration in Khmer, you can use `fromNow()` method that checks the date that you parse compare with your current timestamp. The default `fromNow` method will add space between duration, if you want to remove space just add `fromNow(false)`Ex:

```
KhmerDateTime::parse('2012-10-20')->fromNow() // ៧ ឆ្នាំមុន
KhmerDateTime::parse('2012-10-20')->fromNow(false) // ៧ឆ្នាំមុន
```

Below is the example how `fromNow()` method works

CodeCurrent timestampOutput`KhmerDateTime::parse('2012-10-20')->fromNow()``2020-09-20``៧ ឆ្នាំមុន``KhmerDateTime::parse('2020-03-20')->fromNow()``2020-09-20``៦ ខែមុន``KhmerDateTime::parse('2020-09-15')->fromNow()``2020-09-20``៥ ថ្ងៃមុន``KhmerDateTime::parse('2020-09-15 02:00')->fromNow()``2020-09-15 06:00``៤ ម៉ោងមុន``KhmerDateTime::parse('2020-09-15 06:00')->fromNow()``2020-09-15 06:03``៣ នាទីមុន`If you parse the timestamp in the future

CodeCurrent timestampOutput`KhmerDateTime::parse('2027-10-20')->fromNow()``2020-09-20``៧ ឆ្នាំទៀត``KhmerDateTime::parse('2021-03-20')->fromNow()``2020-09-20``៦ ខែទៀត``KhmerDateTime::parse('2020-09-25')->fromNow()``2020-09-20``៥ ថ្ងៃទៀត``KhmerDateTime::parse('2020-09-15 10:00')->fromNow()``2020-09-15 06:00``៤ ម៉ោងទៀត``KhmerDateTime::parse('2020-09-15 06:03')->fromNow()``2020-09-15 06:00``៣ នាទីទៀត`Using the current timestamp without specific date and time

```
$dateTime = KhmerDateTime::now();
// or
$dateTime = new KhmerDateTime();
```

Contributing
------------

[](#contributing)

Feel free to contribute through PR.

License
-------

[](#license)

This package operates under the MIT License (MIT). See the [LICENSE](https://github.com/phannaly/php-datetime-khmer/blob/master/LICENSE.md) file for details.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~226 days

Total

4

Last Release

1995d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13119017?v=4)[phanna](/maintainers/phannaly)[@phannaly](https://github.com/phannaly)

---

Top Contributors

[![phannaly](https://avatars.githubusercontent.com/u/13119017?v=4)](https://github.com/phannaly "phannaly (26 commits)")

---

Tags

khmer-languagephp-datetimehelpersdatetimekhmercambodia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phannaly-php-datetime-khmer/health.svg)

```
[![Health](https://phpackages.com/badges/phannaly-php-datetime-khmer/health.svg)](https://phpackages.com/packages/phannaly-php-datetime-khmer)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[statamic/stringy

A string manipulation library with multibyte support, forked from @statamic

234.5M14](/packages/statamic-stringy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
