leafs/date

Leaf PHP date module

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

This package is auto-updated.

Last update: 2024-10-25 02:39:38 UTC


README




Tick v2

Latest Stable Version Total Downloads License



Tick is a minimalist PHP library that parses, validates, manipulates, and displays dates and times with a largely DayJS/MomentJS-compatible API. If you use DayJS, you already know how to use 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');

Documentation

Installation

You can easily install Leaf using the Leaf CLI:

leaf install date

Or with Composer:

composer require leafs/date

API

It's easy to use Tick's APIs to parse, validate, manipulate, and display dates and times.

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