I need to be able to store current date (year, month, day) and time (Hour, min, sec) into a CSV file, and read them afterwards.
For creating Date I've tried to use
Date date = new Date();
to construct the current date, but when I
date.toString();
it gives me a very elegant string describing the date and time, which doesn't seem able to store into the CSV file and be read later on. So how do I write to the CSV file in a format that can be read afterwards?
Additionally, reading the CSV file, I've found suggestions like
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date d = df.parse("17/02/2015 01:18:15");
Is this possible, based on the format of the previous output? And what exceptions do I have to catch with this use?
Appreciate any help. Thank you