Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

97
Vistas
Adding day/incrementing with a carbon formatted date

I'm using carbon to get today's date and format it in a laravel blade template, which is not a problem at all, but when it comes to incrementing I'm having an issue

I'm currently testing with just adding a single day, but I want to actually create table headers for today and the next 7 days.

In my blade I have:

<?php 
use Carbon\Carbon;
$date = Carbon::now()->format('m/d/Y');
?>

<thead>
  <tr>
    <th>{{$date}}</th>
    <th>{{$date->addDay()}}</th>
  </tr>
</thead>

But it's saying that I'm calling addDay on a string, which makes sense because I'm formatting the date that way.

Is there a way I can keep this date format of mm/dd/yyyy but also create a loop using something like addDay on that format? I just want to increment for the next 7 days and use those dates as table headers

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

could you try this

<?php 
use Carbon\Carbon;
$format = 'm/d/Y';
$date = Carbon::now();
?>

<thead>
  <tr>
    <th>{{$date->format($format)}}</th>
    <th>{{$date->addDay()->format($format)}}</th>
  </tr>
</thead>

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda