5

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?

Newbie
  • 1,584
  • 9
  • 33
  • 72

1 Answers1

11
Date convertedDatetime = Date.from(datetime.atZone(ZoneId.systemDefault()).toInstant());
Matteo Baldi
  • 5,613
  • 10
  • 39
  • 51