Question: I am storing my 2 Java date types as Date and Time for a MySQL database table. I am using the `SimepleDateFormat("YYYY-MM-dd")` to store the date in my database and it shows up as the correct date when i go to select it. However when i try to parse it back into a util.Date and create a new Event Object, it shows up as `30/12/2012` instead of `31/05/2013` as it is in the database. The time, when parsed into a util.Date and formatted prints out correctly. I am not sure why the Date is printing the wrong date, but the time is printing the correct time.

Database

```
+--------+--------------+-----------+
+ EVENT1 +  2013-05-31  +  02:30:00 +
+--------+--------------+-----------+
+ EVENT2 +  2013-05-31  +  01:00:00 +
+--------+--------------+-----------+

```

Prints:

```
Event1
30/12/2012
02:30
Event2
30/12/2012
01:00

```

Answer: 
The proper method is `rs.getDate(int)`. Take a look at
<http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getDate(int)>

With that method you get a `java.sql.Date` and if you want to transform it to a `java.util.Date` take a look at this [Converting java.sql.Date to java.util.Date](https://stackoverflow.com/questions/6066335/converting-java-sql-date-to-java-util-date)

You can even do this

```
Date date =  rs.getTimestamp(2);

```

By the way, is better to have your date object independent on the format you want to use to show it.
try this...

```
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd");   
Date date =  dateFormat.parse(rs.getDate(2).toString());

```