Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Hacer que el selector de fechas de Bootstrap se muestre como una cadena, pero con el formato aaaa-mm-dddd

Estoy intentando que el selector de fechas de Bootstrap se muestre en formato de cadena, es decir, August 8, 2021 (es decir, en la barra de entrada). Pero quiero que los valores de fecha reales tengan el formato yyyy-mm-dd .

HTML:

 <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" rel="stylesheet"/> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.min.js"></script> <style type="text/css"> .datepicker { font-size: 0.875em; } /* solution 2: the original datepicker use 20px so replace with the following:*/ .datepicker td, .datepicker th { width: 1.5em; height: 1.5em; } </style> <input style= "font-size:14px"id="datepicker">

JavaScript:

 $('#datepicker').datepicker({ weekStart: 1, autoclose: true, format: 'yyyy-mm-dd', startDate: new Date(), Readonly: true, }); $('#datepicker').datepicker("setDate", new Date()); $(function() { $("#datepicker").datepicker(); $("#datepicker").val(); $("#datepicker").on("change",function(){ selectedDate = $(this).val(); update(selectedDate) console.log("datepicker selectedDate is", selectedDate) return selectedDate });

¿Cuál es la forma más fácil de hacer esto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 <!DOCTYPE html> <html lang="en"> <head> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" type="text/css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script> </head> <body> <input style= "font-size:14px"id="datepicker"> <script type="text/javascript"> $('#datepicker').datepicker({ weekStart: 1, autoclose: true, format: 'yyyy-mm-dd', startDate: new Date(), Readonly: true, }); $('#datepicker').change(function(){ var a = $(this).val(); console.log(a); }); </script> </body> </html>

con el código anterior, puede obtener una fecha en formato aaaa/mm/dd. hay algún problema con su coincidencia js con mi código y solucione eso.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!