Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am using Pikaday[^] javascript file for datepicker. its current date format is "Mon Sep 08 2014". I want to show date in format "09/08/2014". how can i do this ? I already tried following

var datepickerFrom = new Pikaday(
   {
       field: document.getElementById('datepickerFrom'),
       firstDay: 1,
       format: "mm/dd/yyyy",
       minDate: new Date('1900-01-01'),
       maxDate: new Date('2040-12-31'),
       yearRange: [1900, 2040]
   });


Thanks in advance for reply.
Posted

I have solved it, placing moment.js before Pikaday.js file and giving format in upper case format: 'MM/DD/YYYY' problem is solved.
 
Share this answer
 
Comments
Karthik_Mahalingam 31-Aug-18 1:49am    
5!
Try using this by replacing the double quotation by single quotation:

C#
var datepickerFrom = new Pikaday(
    {
        field: document.getElementById('datepickerFrom'),
        firstDay: 1,
        format: 'mm/dd/yyyy',
        minDate: new Date('1900-01-01'),
        maxDate: new Date('2040-12-31'),
        yearRange: [1900, 2040]
    });
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900