A library for convert date to Indonesia language, convert time based on timezone and validate date and time
Download composer.phar if you don't have one. Then run it from terminal.
php composer.phar require "satyakresna/masehi: *"
Or, you can put into your composer.json
file.
"require": {
"satyakresna/masehi": "*"
}
Then run composer update
php composer.phar update
Or, the simple way is go to your root project via terminal or cmd and run this command
composer require satyakresna/masehi
By default this library will convert date to Indonesia date automatically. If you wish to deny, simply, just set param "is_local"
to false.
<?php
require 'vendor/autoload.php';
use Masehi\Converter as MasehiConverter;
$masehi = new MasehiConverter;
# Denied convert to local
echo $masehi->convertDate(array(
"date" => "2013/08/25",
"format" => "l, d M Y",
"is_local" => false,
));
echo "\n";
# Output: Sunday, 25 Aug 2013
echo $masehi->convertDate(array(
"date" => "2013/08/25",
"format" => "l, d M Y",
));
echo "\n";
# Output: Minggu, 25 Ags 2013
# Or using static method
echo MasehiConverter::convertDate(array(
"date" => "now",
"format" => "l, d M Y",
"is_local" => false,
));
echo "\n";
# Output: Sunday, 02 Dec 2018
echo MasehiConverter::convertDate(array(
"date" => "now",
"format" => "l, d M Y"
));
echo "\n";
# Output: Minggu, 02 Des 2018
You can also use Util
class to display list of month on your select dropdown of your system (maybe).
<?php
require 'vendor/autoload.php';
use Masehi\Util;
# Use Util class to display list of local month
print_r(Util::implicitMonths());
echo "\n";
print_r(Util::explicitMonths());
echo "\n";
# Those are will output list of implicit local months and explicit local months
- Convert time based on timezone
- Create validator date and time format
- Create contextual output date and time (ex. 15 jam yang lalu)
For a moment I don't received pull request because I want to build this architecture solid. After that I will let you to help me to pull request via code. If just readme, it's fine! Another things to contribute:
- USE THIS LIBRARY. IT'S A MUST!
- Star the repo
- Tell your friends about this awesome library
- Drop an issue if you face a problem