setkyar / datetimeformat
格式化时间
v1.0
2015-03-16 07:15 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is auto-updated.
Last update: 2024-09-11 15:03:46 UTC
README
##安装
通过终端运行以下命令
composer require "setkyar/datetimeformat"
##用法
创建一个 index.php
文件,并将以下代码放入其中,然后运行 $php -S localhost:8000
<?php
// Display Errors On
ini_set('display_errors', 'On');
$autoload = __DIR__.'/vendor/autoload.php';
if ( ! file_exists($autoload))
{
exit("Need to run \"composer install\"!");
}
require $autoload;
use SetKyar\DateTimeFormat\DateTimeFormat;
//What you want to use functions goes here!
##函数
####获取今天
DateTimeFormat::now();
####获取这个月的第一天
DateTimeFormat::firstDayOfthisMonth();
####获取这个月的最后一天
DateTimeFormat::lastDayOfthisMonth());
####获取下个月的第一天
DateTimeFormat::firstDayOfNextMonth());
####下个月的最后一天
DateTimeFormat::lastDayOfNextMonth();
DateTimeFormat::age('22-11-1994');
DateTimeFormat::fromStartOfDay();
DateTimeFormat::endOfDayFromNow();
DateTimeFormat::verifyDate('16-03-2015', 'd-m-y');
##贡献
- 将其Fork(https://github.com/setkyar/time)
- 创建你的功能分支(git checkout -b my-new-feature)
- 提交你的更改(git commit -am '添加一些功能')
- 推送到分支(git push origin my-new-feature)
- 创建一个新的Pull Request
- 星标也欢迎 😄
##许可证
WTFPL