日期组件是一组用于处理日期的方法。
v1.1.0
2019-09-10 18:29 UTC
Requires
- php: ^7.1.3
This package is auto-updated.
Last update: 2024-09-11 14:53:39 UTC
README
日期组件是一组用于处理日期的方法。
安装
composer require flextype-components/date
使用
use Flextype\Component\Date\Date;
获取格式化日期
echo Date::format($date, 'j.n.Y');
获取一分钟中的秒数,按步长递增。
$seconds = Date::seconds();
获取一小时中的分钟数,按步长递增。
$minutes = Date::minutes();
获取小时数,按步长递增。
$hours = Date::hours();
获取月份数。
$months = Date::months();
获取天数。
$months = Date::days();
返回指定月份的天数
$days = Date::daysInMonth(1);
获取年数。
$years = Date::years();
获取当前季节名称
echo Date::season();
获取今天日期
echo Date::today();
获取昨天日期
echo Date::yesterday();
获取明天日期
echo Date::tomorrow();
将UNIX时间戳转换为DOS格式。
$dos = Date::unix2dos($unix);
将DOS时间戳转换为UNIX格式。
$unix = Date::dos2unix($dos);
获取时区
$tz = Date::timezones();
许可
查看LICENSE