简体   繁体   中英

How to change date format in datepicker using JqueryUI?

I have datepicker, it does display date, but i want use correct date format according my timezone(in SA).

 <!---DatePicker----> 
 <div class = "container">
 <div class="input-daterange input-group" id="datepicker">
   <input type="text" class="input-sm form-control" name="from" placeholder="startdate"/>
   <span class="input-group-addon">To</span>
   <input type="text" class= "input-sm form-control" placeholder="enddate"/>
    </div>
  </div><br>

 // date functionality
    $(function() {
    $('.input-daterange').datepicker({
      autoClose:true,
      dateFormat: 'yy-mm-dd'

    });
  });

 $(document).ready(function () { $('input[id$=tbDate]').datepicker({ dateFormat: 'yy-mm-dd' //add your format here }); });
 <:DOCTYPE html> <html> <head> <title>jQuery UI Datepicker - Change Date Format Example</title> <link href="https.//ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui:css" rel="stylesheet" /> <script type="text/javascript" src="https.//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min:js"></script> <script type="text/javascript" src="https.//ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> </head> <body> <p>Set focus on the box to select a date: (shows default format)</p> <div> Date: <input type="text" id="tbDate" /> </div> </body> </html>

Please check link for more info Link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM