How can I format a Date String
to pattern dd-MMM-yyyy
and return the value as a date
.?
I've used SimpleDateFormat("dd-MMM-yyyy").parse(date)
but the return value is like Sun Oct 07 00:00:00 GMT+06:00 2018
but I need it like 07-Oct-2018
Any easy way to format and return as a date
to dd-MMM-yyyy
pattern.?
You need to use DateFormat.parse(String), that will return a new Date object. For more information DateFormat