×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Jose Rosende
Added: Jul 27, 2021 6:49 PM
Views: 3642
Tags: fecha hora
  1. Date elulti = setTime(ultimo, 23, 59, 59, 999);
  2.  
  3. public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second, final int ms) {
  4.         final GregorianCalendar gc = new GregorianCalendar();
  5.         gc.setTime(date);
  6.         gc.set(Calendar.HOUR_OF_DAY, hourOfDay);
  7.         gc.set(Calendar.MINUTE, minute);
  8.         gc.set(Calendar.SECOND, second);
  9.         gc.set(Calendar.MILLISECOND, ms);
  10.         return gc.getTime();
  11.     }