Click here to watch on Youtube:
https://www.youtube.com/watch?v=7w_r2ILMFuI&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
TimestampDemo.java
Output
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/sql/Timestamp.html
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimestampDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimestampDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4cfac93378c4f9d33f18bb5083115d18778294de/BasicJava_2018/TimestampDemo_Intro/?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=7w_r2ILMFuI&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge:
java.sql.Timestamp class Introduction | Java Date and Time |
TimestampDemo.java
import java.sql.Timestamp;
public class TimestampDemo
{
public static void main(String[] args)
{
long millisecond = System.currentTimeMillis();
/*
* Constructs a Timestamp object using a milliseconds time
* value. The integral seconds are stored in the underlying
* date value; the fractional seconds are stored in the nanos
* field of the Timestamp object.
*
* Parameters:
*
* time - milliseconds since January 1, 1970, 00:00:00 GMT. A
* negative number is the number of milliseconds before
* January 1, 1970, 00:00:00 GMT.
*/
Timestamp timestamp = new Timestamp(millisecond);
System.out.println(timestamp);
}
}
public class TimestampDemo
{
public static void main(String[] args)
{
long millisecond = System.currentTimeMillis();
/*
* Constructs a Timestamp object using a milliseconds time
* value. The integral seconds are stored in the underlying
* date value; the fractional seconds are stored in the nanos
* field of the Timestamp object.
*
* Parameters:
*
* time - milliseconds since January 1, 1970, 00:00:00 GMT. A
* negative number is the number of milliseconds before
* January 1, 1970, 00:00:00 GMT.
*/
Timestamp timestamp = new Timestamp(millisecond);
System.out.println(timestamp);
}
}
Output
2018-11-03 11:04:10.96
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/sql/Timestamp.html
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/TimestampDemo_Intro.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/TimestampDemo_Intro
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4cfac93378c4f9d33f18bb5083115d18778294de/BasicJava_2018/TimestampDemo_Intro/?at=master
See also:
No comments:
Post a Comment