Here you can find the source of formatNanosTimeUSEastern(long nanos)
public static String formatNanosTimeUSEastern(long nanos)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Formatter; public class Main { private static DateFormat US_EASTERN_FORMAT_MILLIS = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); public static String formatNanosTimeUSEastern(long nanos) { long millis = nanos / 1000000; Formatter nanosFormat = new Formatter(); nanosFormat.format("%06d", nanos - millis * 1000000); Date d = new Date(millis); synchronized (US_EASTERN_FORMAT_MILLIS) { return US_EASTERN_FORMAT_MILLIS.format(d) + nanosFormat.toString(); }//w w w .j a v a2 s .c o m } }