4

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,380
  • 7
  • 29
  • 64

1 Answers1

9
Date convertedDatetime = Date.from(datetime.atZone(ZoneId.systemDefault()).toInstant());
Matteo Baldi
  • 5,188
  • 10
  • 36
  • 46