Java Timestamp toString() Method

The toString() method of Timestamp class converts the Timespan object in JDBC timestamp escape format.

Syntax

Parameters

NA

Returns

The toString () method of Timestamp class returns a string object in JDBC timestamp escape format .

Overrides

The toString () method of Timestamp class overrides:

toString () method in class Date

Example 1

Output:

Timestamp : 2018-09-01 09:01:15.0
New Timespan : 2018-09-01 09:01:15.0

Example 2

Output:

Timestamp : 2018-09-06 11:13:07.556
Current New Timespan : 2018-09-06 11:13:07.556