samedi 23 janvier 2016

Create date - Carbon in Laravel

I'm starting to read about Carbon and can't seem to figure out how to create a carbon date.

In the docs is says you can;

Carbon::createFromDate($year, $month, $day, $tz); Carbon::createFromTime($hour, $minute, $second, $tz); Carbon::create($year, $month, $day, $hour, $minute, $second, $tz);

But what if I just recieve a date like 2016-01-23? Do I have to strip out each part and feed it to carbon before I can create a carbon date? or maybe I receive time like 11:53:20??

I'm dealing with dynamic dates and time and writing code to separate parts of time or date doesn't feel right.

Any help appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Pe6Igg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire