user2295277
user2295277

Reputation: 219

MYSQL Date and Java Date

i store the current date with the sql code NOW()

After that i have a JAVA application that get that information from database. I use a ResultSet to get that information.

data.setDate(rs.getDate("data"));

Well this works but if i make a println of that i would get something like:

2014-01-27T10:10:10Z

So i would like to remove the T and Z letters when printing the date and sometimes i get the time like this and i don't know why:

00:00:00Z

Thanks

Upvotes: 2

Views: 127

Answers (1)

Salah
Salah

Reputation: 8657

try to use Simple date formatter, like:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// or any date format you want
System.out.println(sdf.format(rs.getDate("data")));

Upvotes: 2

Related Questions