Java Timestamp getTime() MethodThe getTime() method of Timestamp class returns the number of milliseconds since January 1, 1970, 00:00:00 GMT . SyntaxParametersNA ReturnsThe getNanos() method of Timestamp class returns the number of milliseconds since January 1, 1970, 00:00:00 GMT . Example 1Output: Timestamp : 2018-09-01 09:01:15.0 Milliseconds : 1535772675000 Example 2Output: Exception in thread "main" java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] at java.sql.Timestamp.valueOf(Timestamp.java:204) at JavaTimestampGetTimeExample2.main(JavaTimestampGetTimeExample2.java:5) Next TopicJava-timestamp-hashcode-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India