PHPackages                             torzer/laravel-datetime-mutator - 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. [Database &amp; ORM](/categories/database)
4. /
5. torzer/laravel-datetime-mutator

ActivePackage[Database &amp; ORM](/categories/database)

torzer/laravel-datetime-mutator
===============================

Laravel traits mutators to help Date Time manipulation on Eloquent Models

1.1.1(8y ago)23712[1 issues](https://github.com/torzer/laravel-datetime-mutator/issues)MITPHPPHP &gt;=5.4.0

Since Aug 1Pushed 8y ago2 watchersCompare

[ Source](https://github.com/torzer/laravel-datetime-mutator)[ Packagist](https://packagist.org/packages/torzer/laravel-datetime-mutator)[ RSS](/packages/torzer-laravel-datetime-mutator/feed)WikiDiscussions master Synced 1mo ago

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

laravel-datetime-mutator
========================

[](#laravel-datetime-mutator)

Laravel traits mutators to help Date Time manipulation on Eloquent Models.

Installing
----------

[](#installing)

```
composer require torzer/laravel-datetime-mutator

```

Traits
------

[](#traits)

### MapDateTimeMutator

[](#mapdatetimemutator)

The `MapDateTimeMutator` trait is used to set a date and time mutator (only date or time if necessary) related to a specific input format.

WHen using this trait it's not necessary to implement a *setVariableAttribute($value)* mutator to transform a date from a format to another, WHen using this trait it's not necessary to implement a *setVariableAttribute($value)* mutator to transform a date from a format to another, as for example from **d/m/Y** format of a string or object to another that will be used to persist the date in database.

To use it, set in the class:

```
