@@ -26,21 +26,23 @@ Whenever you want to convert any datetime into Khmer language, just wrap it insi
2626
2727Firstly, you can import or instance class
2828``` php
29+ // Using import namespace
2930use Phanna\Converter\KhmerDatetime;
30- ....
31- $khmer = new Phanna\Converter\KhmerDatetime;
31+
32+ // Using fully-qualified class name
33+ $khmer = new Phanna\Converter\KhmerDatetime($date);
3234```
3335
3436After that you can you following method below.
3537
3638``` php
37- $khmer = new KhmerDatetime;
38- $date = date('Y-m-d'); // or specific date that you want
39- // Example output 2019-01-22
39+ $date = '2019-01-22'; // or specific date that you want
40+ $khmer = new KhmerDatetime($date);
4041
41- $khmer->convert($date)-> getDate();
42+ $khmer->getDate();
4243// Output: ២០១៩-មករា-២២
4344```
45+
4446### Available methods
4547
4648This library accept two date format
@@ -50,33 +52,44 @@ $date = '2019-01-22'; // Y-m-d
5052// and
5153$date = '2019/01/22'; // Y/m/d
5254```
53- Some useful method in this library.
55+ There are two way of converting date
56+ - One is passing date through constructor
57+ - Second use date with static method
5458
5559``` php
56- $khmer = new KhmerDatetime;
5760$date = '2019-01-22';
5861
59- $khmer->convert($date)->getFullMonth();
62+ // With constructor
63+ $khmer = new KhmerDatetime($date);
64+
65+ // With static method
66+ $khmer = KhmerDatetime::with($date);
67+
68+ $khmer->getFullMonth();
6069// Output: មករា
6170
62- $khmer->convert($date)-> getFullYear();
71+ $khmer->getFullYear();
6372// Output: ២០១៩
6473
65- $khmer->convert($date)-> getFullDay();
74+ $khmer->getFullDay();
6675// Output: ២២
6776
6877$date = '2019/01/22'; // forward slash format
69- $khmer->convert($date)-> getDate();
78+ $khmer->getDate();
7079// Output: ២០១៩/មករា/២២
7180
7281$date = '2019-01-22'; // dash format
73- $khmer->convert($date)-> getDate();
82+ $khmer->getDate();
7483// Output: ២០១៩-មករា-២២
7584
7685$date = '2019/01/22'; // Reverse from Y/m/d to d/m/Y
77- $khmer->convert($date)-> getDate('reverse');
86+ $khmer->getDate('reverse');
7887// Output: ២២/មករា/២០១៩
7988
89+ // Or wrap it in one line
90+ $date = '2019/01/22';
91+ KhmerDatetime::with($date)->getDate();
92+ // Output: ២០១៩/មករា/២២
8093```
8194
8295## Contributing
0 commit comments