Java Data Type How to - Convert java.sql.Timestamp to LocalDateTime


We would like to know how to convert java.sql.Timestamp to LocalDateTime.


import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
/*from ww w .j  a v  a2  s. c om*/
public class Main {

  public static void main(String[] args) {

  public static LocalDateTime localDateFromTimestamp(Timestamp timestamp) {
    return LocalDateTime
        .ofInstant(timestamp.toInstant(), ZoneOffset.ofHours(0));