leafs/date

Leaf PHP 日期模块

v2.1 2024-08-17 05:18 UTC

This package is auto-updated.

Last update: 2024-09-25 02:34:40 UTC


README




Tick v2

Latest Stable Version Total Downloads License



Tick 是一个极简的 PHP 库,它使用与 DayJS/MomentJS 大致兼容的 API 解析、验证、操作和显示日期和时间。如果你使用过 DayJS,那么你已经知道如何使用 Tick。

tick()->now(); // get the current timestamp
tick()->format('YYYY-MM-DD'); // format the current timestamp
tick()->startOf('month')->add(1, 'day')->set('year', 2018)->format('YYYY-MM-DD HH:mm:ss');

文档

安装

你可以使用 Leaf CLI 轻松安装 Leaf。

leaf install date

或者使用 Composer

composer require leafs/date

API

使用 Tick 的 API 解析、验证、操作和显示日期和时间非常简单。

tick('2018-08-08') // parse
tick()->format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // display
tick()->set('month', 3)->month() // get & set
tick()->add(1, 'year') // manipulate
tick()->isBefore('...') // query