I want to get toDate to unix time format. I used this code:
import java.time.LocalDateTime;
LocalDateTime toDate = LocalDateTime.of(2021, 1, 31, 10, 0, 0)
long unixToDate = toDate.getTime() / 1000
But unfortunately I got this exception:
groovy.lang.MissingMethodException: No signature of method: java.time.LocalDateTime.getTime() is applicable for argument types: () values: []
Possible solutions: getHour(), getMinute(), getNano(), getYear(), clearTime(), get(java.time.temporal.TemporalField)
How can I amend my code?