28. März 200223 j Juten abend Mit welcher Klasse kann ich ein Datum in Millisek. ausgeben. Also sagen wir ich hätter gern das Datum 4.4.2002 um 12:00 uhr. und das nun in Millisek. die aktuelle Uhrzeit und Datum in Millisek. krieg ich ja mit System.currentTimeMillis raus. danke cu empire
28. März 200223 j Hallo, du suchst.... GregorianCalendar public GregorianCalendar(int year, int month, int date, int hour, int minute) Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale. Parameters: year - the value used to set the YEAR time field in the calendar. month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January. date - the value used to set the DATE time field in the calendar. hour - the value used to set the HOUR_OF_DAY time field in the calendar. minute - the value used to set the MINUTE time field in the calendar. Beispiel: import java.util.*; class { public static void main(String args[]) { GregorianCalendar c = new GregorianCalendar(int year, int month, int date, int hour, int minute); System.out.println(c.getTime().getTime()); } } Gruß Jaraz
29. März 200223 j Alternativ kannst du auch java.util.Date verwenden java.util.Date d = new java.util.Date(); System.out.println("CurrentTime in millis="+d.getTime()); Die meisten Methoden aus java.util.Date sind jedoch deprecated - also für weitergehende Berechnungen wirklich den GregorianCalendar verwenden. Snowghost
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.