Answer the question
In order to leave comments, you need to log in
How to parse a date into the correct format in Java?
I have a date in the form : Tue Apr 19 00:00:00 ALMT 2022
how can I parse it into the format 19/04/2022
?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
var s = "Tue Apr 19 00:00:00 ALMT 2022";
var format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy", Locale.ENGLISH);
var date = format.parse(s);
var newFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH);
var formatedDate = newFormat.format(date);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question