Languages
[Edit]
EN

Java - convert Timestamp to Instant

4 points
Created by:
maxsior322
227

Quick solution:

import java.sql.Timestamp;
import java.time.Instant;

public class Example {

    public static void main(String[] args) {

        Timestamp timestamp = new Timestamp(1631189155668L);
        
        Instant instant = timestamp.toInstant();
        System.out.println(instant); // 2021-09-09T12:05:55.668Z
    }
}

 

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join