Tak jsem vyplodil toto:
import java.util.*;
import java.text.*;
import java.util.Calendar;
public class Datum {
public static void main(String[] args) {
long setmili, curentmili, resultmili, resultmin, resulthour, resultday;
Date curentDate = new Date(); // vypsani aktualniho data
SimpleDateFormat df = new SimpleDateFormat("d.M.Y HH:mm");
curentmili = curentDate.getTime(); // prevod na milisekundy
System.out.println("Dnes je: " + df.format(curentDate) + " hod.");
System.out.println("V ms to je: " + curentmili + "\n");
Calendar curentDate2 = Calendar.getInstance(); // nastaveni konkretniho data
curentDate2.setLenient(false);
curentDate2.set(2011, 10, 20, 22, 15, 00);
setmili = curentDate2.getTimeInMillis(); // prevod na milisekundy
System.out.println("Nastaveny datum je: " + df.format(curentDate2.getTime()) + " hod.");
System.out.println("V ms to je: " + setmili + "\n");
resultmili = (curentmili - setmili); // vypocty casu
resultmin = (resultmili / 1000 / 60);
resulthour = (resultmin / 60);
resultday = (resulthour / 24);
System.out.println("Rozdil mezi daty je: " + resultmili + // vypsani rozdilneho casu
" ms" + ", coz je " + resultmin + " minut" + ", coz je " + resulthour + " hodin" +
", coz je " + resultday + " dni.");
}
}
Muzete to pls scihnout, jestli to neni vylozene blbost, evt. zda-li se neco standartne dela jinak?!