Displays countdown timers on websites.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE.txt
README.md
composer.json
phpunit.xml.dist

README.md

Build Status

randomhost/countdown

This package uses PHP Date functions to calculate the difference between two \DateTime objects while adding additional functionality such as disallowing negative values.

It is meant for displaying countdown timers on websites.

Usage

A basic approach at using this package could look like this:

<?php
namespace randomhost\Date;

require_once '/path/to/vendor/autoload.php';

// set default timezone
date_default_timezone_set('UTC');

// setup date object
$start = new \DateTime('OCT 21 2015 04:29 PM');

// setup countdown
$countdown = new Countdown($start);

// returns a \DateInterval object
var_export($countdown->getDateDiff());

This will instantiate the countdown and return a \DateInterval object.

License

See LICENSE.txt for full license details.