Skip to content

peter279k/carbon-extended

Repository files navigation

carbon-extended

Build Status Coverage Status StyleCI

Introduction

  • It can use some extended format on Carbon::format method

Installation

Using the composer to install this package

composer require lee/carbon-extended:^1.0

Usage

  • The CarbonExtended class extends Carbon and it can use createFromFormat to create the Carbon class instance and do format with extended foramts.
use Lee\CarbonExtended;

$date = '2013-03-17';
$customizedFormat = 'QTR.';

$carbonExtended = CarbonExtended::createFromFormat('Y-m-d', $date);
$result = $carbonExtended->extendedFormat($customizedFormat); // 1

Available extended date formats

  • The customized format name is refer on SAS date format
  • Here are available extended formats: (it will have more customized formats...)
customized format name references
QTR. QTR. reference
QTRR. QTRR. reference
JULDAY3. JULDAY3. reference
SAS_DATE_VALUE SAS_DATE_VALUE reference
JULIAN5. JULIAN5. reference
JULIAN7. JULIAN7. reference
PDJULG4. PDJULG4. reference
TIMEAMPM. TIMEAMPM. reference

References

SAS date documentation

About

The extended format for Carbon class instance

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages