Here you can find the source of truncNanos(Timestamp timestamp)
public static Timestamp truncNanos(Timestamp timestamp)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; public class Main { public static Timestamp truncNanos(Timestamp timestamp) { Timestamp ts = new Timestamp(timestamp.getTime()); ts.setNanos((ts.getNanos() / 1000000) * 1000000); return ts; }// ww w .j a v a2s . co m public static int getNanos(Timestamp timestamp) { return timestamp.getNanos(); } }