PHPackages                             dasprid/local-date-time - 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. dasprid/local-date-time

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

dasprid/local-date-time
=======================

Local date and time implementation

1.1.0(7y ago)0135BSD-2-ClausePHPPHP ~7.2

Since Feb 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/DASPRiD/local-date-time)[ Packagist](https://packagist.org/packages/dasprid/local-date-time)[ RSS](/packages/dasprid-local-date-time/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

LocalDateTime
=============

[](#localdatetime)

[![Build Status](https://camo.githubusercontent.com/9d35de1cc1ed30b04d348c4ca8a644421de23016506eb7d37fc48867e6e3c5eb/68747470733a2f2f7472617669732d63692e6f72672f444153505269442f6c6f63616c2d646174652d74696d652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DASPRiD/local-date-time)[![Coverage Status](https://camo.githubusercontent.com/7362f4445e08c7ed516be0f9020a79dcd893b3d23f26f2b69a5f687524963795/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f444153505269442f6c6f63616c2d646174652d74696d652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/DASPRiD/local-date-time?branch=master)[![Reference Status](https://camo.githubusercontent.com/334148813640926307c6c59266e55abfe674aaa8cf48de416b297d4c9bcbb3fe/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f646173707269643a6c6f63616c2d646174652d74696d652f7265666572656e63655f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/php/dasprid:local-date-time/references)[![Latest Stable Version](https://camo.githubusercontent.com/103271ca193612abb387f82911dd105c73188334181af661805032d18208c775/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f6c6f63616c2d646174652d74696d652f762f737461626c65)](https://packagist.org/packages/dasprid/local-date-time)[![Total Downloads](https://camo.githubusercontent.com/7d280f4f0111a6cdd0134687bbed7c6b562d74e13b071e017b667f39b66c4493/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f6c6f63616c2d646174652d74696d652f646f776e6c6f616473)](https://packagist.org/packages/dasprid/local-date-time)[![License](https://camo.githubusercontent.com/f52cdeaf29cf93d9aaa705d1663ca3cdab9bf106479f2c53f1b1d059249b4e3f/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f6c6f63616c2d646174652d74696d652f6c6963656e7365)](https://packagist.org/packages/dasprid/local-date-time)

LocalDateTime is a lightweight wrapper around PHP's own DateTime object, allowing for smooth work with local date, time and date time without worrying about time zones. Each temporal object allows the same ways of comparision, modification and formatting as the underlying DateTime object.

Additionally this library comes with a wrapper around IntlDateFormatter, specifically aimed to format local temporals. For ease of integration, Doctrine types for these temporals are provided as well.

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

[](#installation)

Install via composer:

```
$ composer require dasprid/local-date-time
```

Getting started
---------------

[](#getting-started)

There are three temporal objects supplied:

- `DASPRiD\LocalDateTime\LocalDate`
- `DASPRiD\LocalDateTime\LocalTime`
- `DASPRiD\LocalDateTime\LocalDateTime`

All of these are constructed in a similar fashion through named constructors. For simplicity, the following examples illustrate working with the `LocalDate` object.

### Creation

[](#creation)

A `LocalDate` object can be constructed in multiple ways:

```
