satyakresna/masehi

此包已被放弃且不再维护。未建议替代包。

将日期转换为印度尼西亚语言,根据时区转换时间,并验证日期和时间

v0.12.1 2018-12-10 03:22 UTC

This package is auto-updated.

Last update: 2022-01-10 14:29:51 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

一个用于将日期转换为印度尼西亚语言、根据时区转换时间以及验证日期和时间的库

安装

如果您还没有,请下载 composer.phar。然后在终端中运行它。

php composer.phar require "satyakresna/masehi: *"

或者,您可以将它放入您的 composer.json 文件中。

"require": {
  "satyakresna/masehi": "*"
}

然后运行 composer update

php composer.phar update

或者,简单的方法是通过终端或cmd进入您的根项目,并运行此命令

composer require satyakresna/masehi

使用方法

默认情况下,此库将自动将日期转换为印度尼西亚日期。如果您希望拒绝,只需将参数 "is_local" 设置为 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

您还可以使用 Util 类显示您系统(可能)下拉列表中的月份列表。

<?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

正在进行中的项目

  • 根据时区转换时间
  • 创建日期和时间格式验证器
  • 创建上下文输出的日期和时间(例如,15小时前)

如何贡献?

目前我没有收到拉取请求,因为我想要构建一个坚固的架构。之后,我将让您通过代码帮助我进行拉取请求。如果是README,那就行了!其他贡献方式

  1. 使用这个库。这是必须的!
  2. 为仓库加星标
  3. 告诉你的朋友这个惊人的库
  4. 如果你遇到问题,请提交问题