45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package pr2.io.datainputoutput_1;
|
|
|
|
import java.io.DataOutputStream;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.text.DateFormat;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Scanner;
|
|
|
|
public class DateWriter {
|
|
|
|
/**
|
|
* Dateiname mit den Testdaten.
|
|
*/
|
|
public static final String DATEINAME = "/tmp/test.data";
|
|
|
|
/**
|
|
* Datumsformat.
|
|
*/
|
|
public static final String FORMAT = "yyyy-MM-dd";
|
|
|
|
public static void main(String[] args) {
|
|
Date date = new Date();
|
|
|
|
System.out.printf("Format: yyyy-MM-dd: ");
|
|
Scanner scanner = new Scanner(System.in);
|
|
String eingabe = scanner.next();
|
|
Date datum = getTime(eingabe);
|
|
|
|
|
|
try {
|
|
FileOutputStream fs = new FileOutputStream(DATEINAME);
|
|
DataOutputStream stream = new DataOutputStream(eingabe);
|
|
// TODO: Implementieren
|
|
|
|
} catch (FileNotFoundException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
}
|
|
}
|