Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Datum in Millisek ausgeben?

Empfohlene Antworten

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

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

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.