I'm trying to add 2 months to a date with Carbon, but I keep getting this error:
InvalidArgumentException in Carbon.php line 252:
Unknown or bad timezone (2017-02-25 14:25:24)
Here is my code:
<?php
public function giveMonths(Request $request)
{
$query = DB::table('users')->where('level', '=', 2)->get();
foreach ($query as $row) {
$id = $row->id;
$expires = $row->expires;
$newDate = Carbon::now($expires)->addMonths(2);
dd($newDate);
}
In "app.php" the timezone is set this way:
'timezone' => 'America/Sao_Paulo'
The timezone stored in the DB is in this format:
2017-02-25 03:51:12
How can I solve this problem?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kX5xee
via IFTTT
Aucun commentaire:
Enregistrer un commentaire