Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
Was?das datum als variable wert bestimmen also einmal das Jahr einmal den Monat und dann noch den tag
import java.time.*;
public class AktuellesDatum {
public static void main(String[] args) {
LocalDate now = LocalDate.now();
System.out.println("Tag: " + now.getDayOfMonth());
System.out.println("Monat: " + now.getMonthValue());
System.out.println("Jahr: " + now.getYear());
}
}
Hey ja ich möchte das jedes Mal wenn die Datei gestartet wird sie das aktuelle Datum ermittelt und als variabel Wert abspeichern damit sie mit dem Wert weiterarbeiten kann. Würde das dann einfach auch gehen wenn ich es z.B. so mache „int Tag = now.getDayofMonth();“ ?Möchtest du das aktuelle Datum (im Gregorianischen Kalender) ermitteln und davon dann den Tag, den Monat und das Jahr als Ganzzahlwerte haben?
Java:import java.time.*; public class AktuellesDatum { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println("Tag: " + now.getDayOfMonth()); System.out.println("Monat: " + now.getMonthValue()); System.out.println("Jahr: " + now.getYear()); } }
Ja.Würde das dann einfach auch gehen wenn ich es z.B. so mache „int Tag = now.getDayofMonth();“ ?