2017 © Pedro Peláez
 

library carbon

A simple API extension for DateTime.

image

urepo/carbon

A simple API extension for DateTime.

  • Sunday, June 7, 2015
  • by ureop
  • Repository
  • 1 Watchers
  • 0 Stars
  • 254 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 973 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

Carbon

Latest Stable Version Total Downloads Build Status, (*1)

A simple PHP API extension for DateTime. http://carbon.nesbot.com, (*2)

printf("Right now is %s", Carbon::now()->toDateTimeString());
printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver'));  //implicit __toString()
$tomorrow = Carbon::now()->addDay();
$lastWeek = Carbon::now()->subWeek();
$nextSummerOlympics = Carbon::createFromDate(2012)->addYears(4);

$officialDate = Carbon::now()->toRfc2822String();

$howOldAmI = Carbon::createFromDate(1975, 5, 21)->age;

$noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London');

$worldWillEnd = Carbon::createFromDate(2012, 12, 21, 'GMT');

// Don't really want to die so mock now
Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1));

// comparisons are always done in UTC
if (Carbon::now()->gte($worldWillEnd)) {
   die();
}

// Phew! Return to normal behaviour
Carbon::setTestNow();

if (Carbon::now()->isWeekend()) {
   echo 'Party!';
}
echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago'

// ... but also does 'from now', 'after' and 'before'
// rolling up to seconds, minutes, hours, days, months, years

$daysSinceEpoch = Carbon::createFromTimeStamp(0)->diffInDays();

Installation

With Composer

$ composer require nesbot/carbon
{
    "require": {
        "nesbot/carbon": "~1.14"
    }
}
<?php
require 'vendor/autoload.php';

use Carbon\Carbon;

printf("Now: %s", Carbon::now());

, (*3)

Without Composer

Why are you not using composer? Download Carbon.php from the repo and save the file into your project path somewhere., (*4)

<?php
require 'path/to/Carbon.php';

use Carbon\Carbon;

printf("Now: %s", Carbon::now());

The Versions

07/06 2015

dev-master

9999999-dev https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

 

The Development Requires

date time datetime

07/06 2015

1.19.1

1.19.1.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

 

The Development Requires

date time datetime

09/05 2015

1.19.0

1.19.0.0 http://carbon.nesbot.com

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

 

The Development Requires

date time datetime

26/03 2015

1.18.0

1.18.0.0 http://carbon.nesbot.com

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

 

The Development Requires

date time datetime

08/03 2015

1.17.0

1.17.0.0 http://carbon.nesbot.com

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

04/03 2015

1.16.0

1.16.0.0 http://carbon.nesbot.com

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

03/03 2015

1.15.0

1.15.0.0 http://carbon.nesbot.com

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

06/02 2015

1.14.0

1.14.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

26/09 2014

1.13.0

1.13.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

10/09 2014

1.12.0

1.12.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

26/08 2014

1.11.0

1.11.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

18/07 2014

1.10.0

1.10.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

13/05 2014

1.9.0

1.9.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

07/01 2014

1.8.0

1.8.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

05/12 2013

1.7.0

1.7.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

23/11 2013

1.6.0

1.6.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

21/11 2013

1.5.0

1.5.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

date time datetime

09/09 2013

1.4.0

1.4.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime

21/08 2013

1.3.0

1.3.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime

15/10 2012

1.2.0

1.2.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime

17/09 2012

1.1.0

1.1.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime

11/09 2012

1.0.1

1.0.1.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime

11/09 2012

1.0.0

1.0.0.0 https://github.com/briannesbitt/Carbon

A simple API extension for DateTime.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

date time datetime