Java Timestamp truncNanos(Timestamp timestamp)

Here you can find the source of truncNanos(Timestamp timestamp)

Description

trunc Nanos

License

Open Source License

Declaration

public static Timestamp truncNanos(Timestamp timestamp) 

Method Source Code


//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();
    }
}

Related

  1. timestampPlusDay(java.sql.Timestamp ts, int iDayPlus)
  2. timestampPlusDay2DDMMYYYY(java.sql.Timestamp ts, int iDayPlus)
  3. trunc(Timestamp dayTime, String trunc)
  4. truncateFractionalSeconds(Timestamp timestamp)
  5. truncateTimestamp(Timestamp timestamp, String period)
  6. unformattedFromTimestamp(java.sql.Timestamp t)
  7. utcToTimestamp(String utcTimestamp)
  8. weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale)
  9. writeTimestamp(ByteBuffer logBuf, Timestamp time)