1

I tried:

var second_date = moment(currentdate).format('DD-MM-YYYY');

Its showing

Uncaught Reference Error: moment is not defined.

 success: function(response){

            var len = 0;
            if(response != null){

                len = response.length;

            for(var i=0; i<len; i++)
            {

               var id = response[i].id;
               var currentdate = response[i].currentdate;
               var name = response[i].name;
             }
          }
  • You need to install moment – Ankur Tiwari Nov 28 '19 at 04:46
  • Does this answer your question? [How to get current formatted date dd/mm/yyyy in Javascript and append it to an input](https://stackoverflow.com/questions/12409299/how-to-get-current-formatted-date-dd-mm-yyyy-in-javascript-and-append-it-to-an-i) – Ankur Tiwari Nov 28 '19 at 04:47

1 Answers1

0

Make sure that your cdn script for moment is added and below Jquery cdn

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>

Then it'll work

Khalid Khan
  • 3,017
  • 1
  • 11
  • 27