Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the date range picker's date format?

Tags:

I am using this bootstrap date range picker. I want to change date format date to dd/MMM/yyyy:

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" />  <!-- Include Date Range Picker --> <script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>  <script type="text/javascript"> $(function() {     $("#<%= txtName.ClientID %>").daterangepicker(); }); </script> 
like image 345
ayman Avatar asked Sep 26 '15 19:09

ayman


People also ask

How do I change the format of a date range?

Press Ctrl+1 to open the Format Cells dialog. Alternatively, you can right click the selected cells and choose Format Cells… from the context menu. In the Format Cells window, switch to the Number tab, and select Date in the Category list. Under Type, pick a desired date format.

How do I change date picker format in Word?

From the Insert drop-down menu, select Date/Time. Select the appropriate format. Click OK.

How do you set a date range in HTML?

To set and get the input type date in dd-mm-yyyy format we will use <input> type attribute. The <input> type attribute is used to define a date picker or control field. In this attribute, you can set the range from which day-month-year to which day-month-year date can be selected from.

How do I change date picker format in Excel?

Display the current date and time in a date pickerClick the Data tab. In the Data type box, click Date and Time (dateTime). Click Format. In the Date and Time Format dialog box, in the Display the time like this list, click the option that you want, and then click OK.


1 Answers

If you want to present a different format, you need to add a locale object after you run the daterangepicker function. The site doesn't currently have a list of all the formats it supports, but try this:

$(function() {     $("#<%= txtName.ClientID %>").daterangepicker({         locale: {             format: 'DD/MMM/YYYY'         }     }); }); 

See here for more options: http://www.daterangepicker.com/#config

like image 62
Reisclef Avatar answered Sep 30 '22 17:09

Reisclef