Click here to watch on Youtube:
https://www.youtube.com/watch?v=meIrUIzlRdg&list=UUhwKlOVR041tngjerWxVccw
TimestampDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimestampDemo_from.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimestampDemo_from
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/5bada39e8532ab4b75aaa28b80cdcee21bf19ab7/BasicJava_2018/TimestampDemo_from/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=meIrUIzlRdg&list=UUhwKlOVR041tngjerWxVccw
TimestampDemo.java
import java.sql.Timestamp;
import java.time.Instant;
public class TimestampDemo
{
public static void main(String[] args)
{
Instant instant = Instant.now();
System.out.println("instant = "+ instant);
/*
* Parameters:
*
* instant - the instant to convert
*
* Returns:
*
* an Timestamp representing the same point on the time-line
* as the provided instant
*/
Timestamp timestamp = Timestamp.from(instant);
System.out.println("timestamp = "+timestamp);
}
}
import java.time.Instant;
public class TimestampDemo
{
public static void main(String[] args)
{
Instant instant = Instant.now();
System.out.println("instant = "+ instant);
/*
* Parameters:
*
* instant - the instant to convert
*
* Returns:
*
* an Timestamp representing the same point on the time-line
* as the provided instant
*/
Timestamp timestamp = Timestamp.from(instant);
System.out.println("timestamp = "+timestamp);
}
}
Output
instant = 2018-11-25T02:54:24.089Z
timestamp = 2018-11-25 08:24:24.089
timestamp = 2018-11-25 08:24:24.089
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimestampDemo_from.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimestampDemo_from
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/5bada39e8532ab4b75aaa28b80cdcee21bf19ab7/BasicJava_2018/TimestampDemo_from/?at=master
See also:
No comments:
Post a Comment