I am subtracting 24 hours from a GregorianCalendar 03/25/2018 09:41.
Result 03/24/2018 08:41
.
public class Utiles{
public static void main(String args[]) {
SimpleDateFormat sdt = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
GregorianCalendar gcFinAux = new GregorianCalendar(2018, 2, 25, 9, 41, 0);
System.out.println("1. " + sdt.format(gcFinAux.getTime()));
gcFinAux.add(Calendar.HOUR_OF_DAY, -24);
System.out.println("2. " + sdt.format(gcFinAux.getTime()));
}
}
Output:
1. 25/03/2018 09:41:00
2. 24/03/2018 08:41:00
If I try with another date the result is correct.
I try in Linux and Windows with JDK1.6.0_45 and Java 1.8.
Could someone confirm if you get the same results?
Thank you.