Languages
[Edit]
EN

Java - convert Timestamp to Instant

4 points
Created by:
maxsior322
287

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
    }
}

 

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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