I have a date object which, if I print, gives me Mon Feb 11 01:21:00 CST 2019. I want to convert this to a 24 HRS date Format. I do not want strings as output or input. Please try to keep the input and output variables as Date object only.
Edit : I want to further use the converted date To use Collections.sort on an Arraylist. I am able to do so in the present implementation as well, but In here 12:55 AM is being ordered way later than 1:15 AM for the same date, which should otherwise be ordered before it.
I am using Java 6. and am overriding compare method from the comparator to do the two parameters based sorting of which date is the second parameter.
Edit 2 : It is different because I want the output as a date Object and not as a string Object. Converting it to a string, using SimpleDateFormat, there are 'n' number of ways to do it but I want the output as a Date object so as to do the sorting and as I mentioned I am running on java 6.