cambodev / date-converter
Convert en date to kh date
v1.0.2
2023-08-17 09:02 UTC
README
Laravel PHP package use to conver en date to khmer date. Ex: 2023-01-01 to ថ្ងៃទី០១ ខែមករា ឆ្នាំ២០២៣
Installation
You can install the package via composer:
composer require cambodev/date-converter
Configuration
To your config/app.php
'timezone' => 'Asia/Phnom_Penh',
Laravel 5.5 and above
You don't have to do anything else, this package autoloads the Service Provider and create the Alias, using the new Auto-Discovery feature. Add the Service Provider and Facade alias to your config/app.php
Laravel 5.4 and below
CamboDev\DateConverter\ConverterServiceProvider::class, 'KmFormat' => CamboDev\DateConverter\KmFormatFacade::class,
Using
Use the Facade
$date = date('Y-m-d H:i:s'); $dateTime = KmFormat::to($date)->format("LLLL"); echo $dateTime; $dateTime = KmFormat::to($date); $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(); // ត្រីមាសទី២
Format
License
CamboDev is licensed under the MIT License