I get Date as java.util.Date(not String) : (java.util.Date) Mon Jul 13 00:00:00 IST 2020
I want to convert it to : 2020-07-13T00:00 format==>("yyyy-MM-dd'T'HH:mm") but as DATE not String.
I tried following code:
Date scheduleDate=details.getScheduledDate(); // This value is fetched from object passed-- [scheduleDate = (java.util.Date) Mon Jul 13 00:00:00 IST 2020]
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
sd.setTimeZone(TimeZone.getTimeZone("Asia/Kolkata"));
String dateFormat=sd.format(scheduleDate); //Here I get [dateFormat = (java.lang.String) "2020-07-13T00:00"]
Date date = sd.parse(dateFormat); //[date = (java.util.Date) Mon Jul 13 00:00:00 IST 2020]
I observed that string format has correct(as expected ) value but the value changes back when I convert it to java.util.date.
Does java.util.Date support yyyy-MM-dd'T'HH:mm format ?
If yes, Can anyone suggest me with any good approach/direction/topics/library to look into.
Thank You..