Java Timestamp getNanos() Method

The getNanos() method of Timestamp class fetches the Timestamp object's nanos value .

Syntax

Parameters

NA

Returns

The getNanos() method of Timestamp class returns this Timestamp object?s nanos value.

Example 1

Output:

Timestamp : 2018-09-01 09:01:15.0
Fractional seconds component : 0

Example 2

Output:

Timestamp : 2018-09-01 09:01:15.45
Fractional seconds component : 450000000