Timestamp.setNanos(int n) has the following syntax.
public void setNanos(int n)
In the following code shows how to use Timestamp.setNanos(int n) method.
public class Main { public static void main(String[] args) { java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2013-04-06 09:01:10"); /* w w w . j ava 2s . co m*/ long tsTime2 = ts2.getTime(); System.out.println(tsTime2); ts2.setNanos(123); System.out.println(tsTime2); } }
The code above generates the following result.