Kodumda bir mantık hatası var gibi görünüyor. Şuanki zaman: 14:38, ama Kodum 18:38 diyor. Kullanabileceğim bir Takvim sınıfı olduğunu biliyorum, ancak bu kodun neden yanlış olduğunu 'a bilmek istiyorum. AşağıdaJava'da Geçerli Saat (Mantık Hatası) Saat Dilimi: ABD Doğu Saati
Kod: Eğer hesaplama gerçekleştirdiğinizde
public class welcome{
public static void main(String args[]){
//get total milliseconds since 1970
long total_millisec = System.currentTimeMillis();
// compute total seconds since 1970
long total_sec = total_millisec/1000;
//compute current second
long current_sec = total_sec % 60;
//compute total minutes since epoch
long total_mins = total_sec/60;
//compute current minute
long current_min = total_mins % 60;
//compute total hours
long total_hours = total_mins/60;
//compute current hour
long current_hour = total_hours % 24;
System.out.println("Time is: "+current_hour+":"+current_min+":"
+current_sec);
}
}
saat dilimi içinde mi? System.currentTimeMillis() '', 1.1.1970 * UTC * 'den beri milisaniye döndürür. – f1sh
ABD'deyim. Doğu saati – BattleDrum
Nice! Yani ET – BattleDrum