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

377
Vistas
Can't Get Bootstrap DateTime Picker To Show Formatted database Value in Form Field

I am trying to use the Bootstap DateTime picker in a Laravel project.
https://www.malot.fr/bootstrap-datetimepicker/

I am working on an edit page where a date is pulled from the database and should display formatted as mm/dd/yyyy hh:ii in an input field. I need that DT picker to start off from the same DT. I cannot figure out how to do it without messing up the InitialDate for the timePicker. If I add a formatted value to the input value field, it sends the InitialDate of the DT picker back to Dec 1899.

Here is the Javascript portion of the code:

<script src="{{asset('/assets/plugins/bootstrap-datetime-picker/js/bootstrap-datetimepicker.js')}}"></script>
 $(".form_datetime").datetimepicker({
            format: "mm/dd/yyyy hh:ii",
            initialDate:  "{{ $post->post_date }}",
            autoclose: true,
            todayBtn: true,
            pickerPosition: "bottom-left",
            minuteStep: 10
        });

Here is the form field without the formatted DT.

<input class="form-control @error('post_date') is-invalid @enderror"  type="text" value="" readonly id="post_date" name="post_date">

Here is the form field with the formatted DT:

{{ $post->post_date->format('m/d/Y H:i:s') }}

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can try this

{{ \Carbon\Carbon::parse($post->post_date)->format('m/d/Y H:i:s') }}
about 4 years ago · Juan Pablo Isaza 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