1

This is my code

 <input type="date" class="form-control float-right" value="dd-mm-yyyy" name="from_date_bk" id="from_date_bk">

And it returns like this enter image description here

I want dd/mm/yyyy format

  • 2
    You’re mixing jquery with php. Php only works on the server, not in the browser. See https://stackoverflow.com/questions/8398897/how-to-get-current-date-in-jquery – Tim Morton Mar 06 '19 at 03:41

1 Answers1

0

Suppose your date is 2019-01-15

var date = "2019-01-15";
var d = new Date(date);

var month = d.getMonth()+1;
var day = d.getDate();

var output = (day<10 ? '0' : '') + day +'-'+ (month<10 ? '0' : '') + month + '-' +d.getFullYear();

Result

15-01-2019
Danish Ali
  • 2,354
  • 3
  • 15
  • 26