help me lord
This commit is contained in:
parent
fb196693e4
commit
db6b2a2a6e
42 changed files with 342 additions and 0 deletions
BIN
Code/Steiner/simpleCalender/src/App.class
Normal file
BIN
Code/Steiner/simpleCalender/src/App.class
Normal file
Binary file not shown.
14
Code/Steiner/simpleCalender/src/App.java
Normal file
14
Code/Steiner/simpleCalender/src/App.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
public class App {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
SimpleCalendar simpleCalendar = new SimpleCalendar();
|
||||
// Aktuelles Datum und Uhrzeit formatieren und ausgeben
|
||||
System.out.println("Aktuelles Datum und Uhrzeit:");
|
||||
System.out.println(simpleCalendar.getFormattedDate());
|
||||
|
||||
// Zeit manipulieren
|
||||
simpleCalendar.add(SimpleCalendar.DAY_OF_MONTH, 5);
|
||||
System.out.println("Datum in 5 Tagen:");
|
||||
System.out.println(simpleCalendar.getFormattedDate());
|
||||
}
|
||||
}
|
BIN
Code/Steiner/simpleCalender/src/SimpleCalendar.class
Normal file
BIN
Code/Steiner/simpleCalender/src/SimpleCalendar.class
Normal file
Binary file not shown.
15
Code/Steiner/simpleCalender/src/SimpleCalendar.java
Normal file
15
Code/Steiner/simpleCalender/src/SimpleCalendar.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
import java.util.GregorianCalendar;
|
||||
|
||||
public class SimpleCalendar extends GregorianCalendar {
|
||||
|
||||
public String getFormattedDate() {
|
||||
int year = get(GregorianCalendar.YEAR);
|
||||
int month = get(GregorianCalendar.MONTH) + 1; // Monate sind 0-basiert
|
||||
int day = get(GregorianCalendar.DAY_OF_MONTH);
|
||||
int hour = get(GregorianCalendar.HOUR_OF_DAY);
|
||||
int minute = get(GregorianCalendar.MINUTE);
|
||||
int second = get(GregorianCalendar.SECOND);
|
||||
|
||||
return String.format("%02d.%02d.%04d %02d:%02d:%02d", day, month, year, hour, minute, second);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue