2017 © Pedro Peláez
 

library php-datetime-calculator

php datetime calculator

image

zhusaidong/php-datetime-calculator

php datetime calculator

  • Thursday, June 21, 2018
  • by zhusaidong
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php-datetime-calculator

php datetime calculator, (*1)

travis license, (*2)

Installation

composer require zhusaidong/php-datetime-calculator

Usage

add or sub time

require('./vendor/autoload.php');

use \zhusaidong\DateTimeCalculator\DateTimeCalculator;

$dtc = new DateTimeCalculator;
$dtc->setTimestamp(time());

echo $dtc->sub(DateTimeCalculator::YEAR,1)->add(DateTimeCalculator::MONTH,1)->format();
//output:2017-07-16 17:36:51

time diff

require('./vendor/autoload.php');

use \zhusaidong\DateTimeCalculator\DateTimeCalculator;

$dtc = new DateTimeCalculator;
$dtc->setTimestamp(time());

echo $dtc->add(DateTimeCalculator::YEAR,1)->diff(DateTimeCalculator::now());
//output:365

methods

format();//format date

diff();//diff date

add();//add date

sub();//sub date

next();//next date

last();//last date

ago();//this function is an alias of sub

The Versions

21/06 2018

dev-master

9999999-dev https://github.com/zhusaidong/php-datetime-calculator/

php datetime calculator

  Sources   Download

BSD-2-Clause

The Requires

  • php >=7.0

 

The Development Requires

by Avatar zhusaidong