I have date string value in input text and I want to convert that text and display in ‘dd-MM-yyyy’ format in that input. How to convert it?
<input type="text" class="form-control" id="orderDateInput" value="11/15/2017 12:00:00 AM">
I have date string value in input text and I want to convert that text and display in ‘dd-MM-yyyy’ format in that input. How to convert it?
<input type="text" class="form-control" id="orderDateInput" value="11/15/2017 12:00:00 AM">
2
Answers
You can use regular expressions:
If the expected input is always in the form
11/15/2017 12:00:00 AM
, i. e. with the date part written with/
as separator, then the target string can be extracted like