I'm using java 8 and i have a method that accepts a date in long format parameter and returns a date in LocalDateTime
from java.time.LocalDateTime
library.
Before with java versions < 8, I used java.util.Date
but now I need to use the java.time.LocalDateTime
but I can't find documentation on how to convert from long
value to LocalDateTime
.
Before:
public Date setDate (long ldate){
Date newDate = new Date(ldate);
return newDate;
}
Now:
public LocalDateTime setDate(long ldate){
LocalDateTime newDate;
//{convert from long to LocalDateTime}
return newDate
}
Thanks for your help!