warmans/date-range

There is no license information available for the latest version (0.0.3) of this package.

Small utility class used to create date range arrays.

0.0.3 2014-10-09 20:54 UTC

This package is not auto-updated.

Last update: 2024-04-22 23:26:18 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

Relative

Thin wrapper around DateTime classes to simplify generating date ranges relative to the current date.

Basic Usage

Create a range instance specifying its options:

$range = new \DateRange\Relative(array('length'=>'60 DAY', 'interval'=>'P1D');

Export the specified range as an array:

var_dump($range->getRange());

It will look something like this:

array(
    '01-01-2014' => array('raw' => \DateTime, 'formatted' => '01-01-2014')
    '02-01-2014' => array('raw' => \DateTime, 'formatted' => '02-01-2014')
    //etc...
)

Options

Option Example Description
length 30 DAYS DateTime format relative date string
modify -1 DAY Offset the date range by this DateTime format relative date string
interval P1D DateInterval format interval
date_format Y-m-d date() style date format for result