Reputation: 1714
I have a string date, and I convert it with statement below:
LocalDateTime datetime = LocalDateTime.parse(rs.getString("DateIn"), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"));
Now I want to convert datetime
into Date
for comparison purpose, how to convert it?
Upvotes: 8
Views: 19858
Reputation: 5828
Date convertedDatetime = Date.from(datetime.atZone(ZoneId.systemDefault()).toInstant());
Upvotes: 15