Skip to content
This repository has been archived by the owner on Jan 2, 2022. It is now read-only.
/ masehi-php Public archive

A library for convert date to Indonesia language, convert time based on timezone and validate date and time

License

Notifications You must be signed in to change notification settings

kresnasatya/masehi-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Masehi PHP

Latest Stable Version Total Downloads Latest Unstable Version License

A library for convert date to Indonesia language, convert time based on timezone and validate date and time

Installation

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

Usage

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

Things on progress

  • Convert time based on timezone
  • Create validator date and time format
  • Create contextual output date and time (ex. 15 jam yang lalu)

How can I contribute?

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:

  1. USE THIS LIBRARY. IT'S A MUST!
  2. Star the repo
  3. Tell your friends about this awesome library
  4. Drop an issue if you face a problem

About

A library for convert date to Indonesia language, convert time based on timezone and validate date and time

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages