T
triopsfreak
Gast
Folgender Code liefert mir 12 als Ausgabe:
Das ist ja auch richtig, aber folgener Code liefert mir 11 als Augabe (jetzt im Moment ist aber 13 Uhr)
Was könnte der Fehler sein, eigentlich sollte der obige Code ja 13 Uhr als Ausgabe liefern, oder habe ich einen Denkfehler?
Danke für die Antworten schon im Vorraus!
Java:
public class Timetest {
public static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;
public static final int MILLIS_IN_HOUR = 60 * 60 * 1000;
public static final int MILLIS_IN_MIN = 60 * 1000;
public static void main(String[] arg) {
long i = 36 * MILLIS_IN_HOUR;
long a = i % MILLIS_IN_DAY;
System.out.println(a / MILLIS_IN_HOUR);
}
}
Java:
public class Timetest {
public static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;
public static final int MILLIS_IN_HOUR = 60 * 60 * 1000;
public static final int MILLIS_IN_MIN = 60 * 1000;
public static void main(String[] arg) {
long i = System.currentTimeMillis()
long a = i % MILLIS_IN_DAY;
System.out.println(a / MILLIS_IN_HOUR);
}
}
Danke für die Antworten schon im Vorraus!