Here you can find the source of timestampToDecimalString(Instant t)
Parameter | Description |
---|---|
t | the timstamp to transform |
public static String timestampToDecimalString(Instant t)
//package com.java2s; import java.text.DecimalFormat; import java.time.Instant; public class Main { private static final ThreadLocal<DecimalFormat> NANO_FORMATTER = ThreadLocal .withInitial(() -> new DecimalFormat("000000000")); /**/*w w w .j av a 2 s . co m*/ * Converts the timestamp to seconds as a floating point (seconds.nano). * * @param t the timstamp to transform * @return the string representation of the timestamp using the decimal format */ public static String timestampToDecimalString(Instant t) { return t.getEpochSecond() + "." + NANO_FORMATTER.get().format(t.getNano()); } }