I'm building a web application and using a JQuery. I send a single String date to my servlet. It's format is "MM/dd/yyyy", how to convert this into dd/MM/yyyy?
Is it possible to set today date to datepicker and can be previous dates block?
I have found a solution using JQuery without using SimpleDateFormat
or Date
$( function() {
$( "#datepicker" ).datepicker({
dateFormat: "dd/mm/yy",
minDate: 0
});
});
To format dates using Java 8, you can use a DateTimeFormatter:
LocalDate ld = LocalDate.parse("12/01/2017", DateTimeFormatter.ofPattern("MM/dd/yyyy"));
System.out.println(ld.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));//prints 01/12/2017
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.