Questions tagged as 'carbon'

1
answer

Error in Laravel DateTime :: __ construct (): Failed to parse time string

Create a virtual host and when entering the URL, sometimes I open the laravel page and others throw me that DateTime error, how can I solve it? I found this: link I do the php artisan key: generate but nothing happens, what follows be...
asked by 12.03.2018 / 03:39
1
answer

Compare date with Carbon in Laravel

I want to implement a logic in my laravel backend using the date of a publication. The example is as follows: A user creates an article, this contains title, content, image, user owner and date of publication, it turns out that the user pu...
asked by 21.07.2017 / 23:26
1
answer

how to calculate age of a person with carbon in laravel?

Greetings I have the following code: $anios=\Carbon\Carbon::parse($paciente->fecha_nacimiento)->age; That basically calculates my age well, but this age is calculated with the current date.    How do I calculate the age for previou...
asked by 02.12.2018 / 04:05
2
answers

Calculate days on a given date per month

Hello, I would like to reflect the number of days of an absent worker from his date of absence either using Carbon or something native in php, use Laravel the example is this: In the BD I consult the absenteeism that said worker has $ause...
asked by 06.11.2018 / 04:18
1
answer

Calculate the average in minutes?

I am trying to calculate the average time between the column created_at and updated_at, but I am having problems with the foreach, since it only takes the last value I send it, and ignores all the others. public function tiempo() { $creaci...
asked by 19.07.2018 / 01:17
1
answer

Iterate schedules with carbon and laravel

Hi, I have the following code with carbon where I want to get an array with the start time until the final hour every 30 min. It does not work for me Any suggestions. $inicio = $horario[0]->end_date; // 08:00:00 $fin...
asked by 28.11.2018 / 17:37