PHPackages                             lee/carbon-sas-date - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lee/carbon-sas-date

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lee/carbon-sas-date
===================

A SAS date format helper for Carbon

v1.0(6y ago)25[1 issues](https://github.com/peter279k/carbon-sas-date/issues)MITPHPPHP &gt;=7.2CI failing

Since Feb 18Pushed 6y ago2 watchersCompare

[ Source](https://github.com/peter279k/carbon-sas-date)[ Packagist](https://packagist.org/packages/lee/carbon-sas-date)[ Docs](https://github.com/peter279k/carbon-sas-date)[ RSS](/packages/lee-carbon-sas-date/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

carbon-sas-date
===============

[](#carbon-sas-date)

[![Build Status](https://camo.githubusercontent.com/673ffeefad41ee4e0f3bc3c3779d4feb87a8f5c133f56075f234da6739ab4734/68747470733a2f2f7472617669732d63692e6f72672f70657465723237396b2f636172626f6e2d7361732d646174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/peter279k/carbon-sas-date)[![Coverage Status](https://camo.githubusercontent.com/aa2ce8b92a7df0b442fdb57bb7c3ea2d5790f59da27730dab2f8777023de66c0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f70657465723237396b2f636172626f6e2d7361732d646174652f62616467652e7376673f6272616e63683d69737375655f25323331)](https://coveralls.io/github/peter279k/carbon-sas-date?branch=issue_%231)[![StyleCI](https://camo.githubusercontent.com/2230b54e120ba10b5febf9daa5c90973df22585f1572adc8cda8c0cf6a8a9f84/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233373836383438302f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/237868480)

Introduction
------------

[](#introduction)

- [SAS](https://en.wikipedia.org/wiki/SAS_language) is a programming language and it has own date manipulation approach.
- This is a helper to let given SAS date/year/time format convert to Carbon date format.
- It can also use SAS date format directly to create a Carbon instance.

Installation
------------

[](#installation)

Using the `composer` to install this package

```
composer require lee/carbon-sas-date:^1.0
```

Notice
------

[](#notice)

Some SAS date formats cannot find current mapped Carbon date formats.

**And it will throw InvalidArgumentException with using these SAS date/year/time formats on CarbonSasHelper::createDateFromFormat, CarbonSasHelper::createTimeFromFormat or CarbonSasHelper::createYearFromFormat method.**

Usage
-----

[](#usage)

### Create from SAS date format via CarbonSasHelper class

[](#create-from-sas-date-format-via-carbonsashelper-class)

```
use Lee\CarbonSasHelper;

$sasDateFormat = 'DDMMYY.';
$sasDate = '17/03/13';

$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('d/m/y'); // '17/03/13'
```

Real case
---------

[](#real-case)

Sometimes it will get following SAS datetime format on the real case:

`06FEB2020:00:00:00.000000`

It has the SAS date and time formats. And the SAS date is `06FEB2020` and format is `DATE9.`.

Then the sample code is:

```
use Lee\CarbonSasHelper;

$sasDateFormat = 'DATE9.';
$sasDate = '06FEB2020';
$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('dMY:00:00:00.000000'); // '06Feb2020:00:00:00.000000'
```

Special cases
-------------

[](#special-cases)

Some SAS date is not same as Carbon date. The know cases are as follows:

```
use Lee\CarbonSasHelper;

$sasDateFormat = 'DATE.';
$sasDate = '17MAR13';
$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('dMy'); // '17Mar13'

$sasDateFormat = 'DATE9.';
$sasDate = '17MAR2013';
$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('dMY'); // '17Mar2013'

$sasDateFormat = 'MONYY.';
$sasDate = 'MAR13';
$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('My'); // 'Mar13'

$sasYearFormat = 'YYMON.';
$sasDate = '2013MAR';
$carbonSasHelper = CarbonSasHelper::createDateFromFormat($sasDateFormat, $sasDate); // Carbon class instance

$carbonSasHelper->format('YM'); // '2013Mar'
```

References
----------

[](#references)

[SAS date documentation](https://documentation.sas.com/?docsetId=lrcon&docsetTarget=p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm&docsetVersion=9.4&locale=en#n1franwnd7n7yrn1kasbprbtzroo)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2274d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/baa74b27c760b02871b04908382ae01967e7d7100c20144c71197cd680b99c98?d=identicon)[peter279k](/maintainers/peter279k)

---

Top Contributors

[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lee-carbon-sas-date/health.svg)

```
[![Health](https://phpackages.com/badges/lee-carbon-sas-date/health.svg)](https://phpackages.com/packages/lee-carbon-sas-date)
```

###  Alternatives

[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[intervention/zodiac

Zodiac Sign Calculator

58191.7k](/packages/intervention-zodiac)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[solspace/craft-calendar

The most powerful event management and calendaring plugin!

1830.8k1](/packages/solspace-craft-calendar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
