There is a Date object. It is necessary to cut off the temporary part of it. Well, for example 22:22 11.11.2011 should be redone at 00:00 11.11.2011. Posted by:

Date startO = new Date(String.valueOf(start.getDate() + '.' + (start.getMonth() + 1) + '.' + start.getYear() )); //собирается строка 11.11.2011 и отдаётся на распарсинье конструктору Date -а (Date start --> Date startO) 

Of course, this code place only here . He is slow and slow, and logically stupid. Tell me how to rewrite it?

ps in this case speed is important to me

pps yes, I know that Date is deprectaed, but I don’t care

    1 answer 1

     Date someDate = ... ; Calendar cal = Calendar.getInstance(); cal.setTime(someDate); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Date newDate = cal.getTime(); 
    • And as I did not guess. But why translate into a calendar if you can start.setSeconds? - kandi