Java Time Format formatTime(long dtNanos)

Here you can find the source of formatTime(long dtNanos)

Description

format Time

License

Open Source License

Declaration

private static String formatTime(long dtNanos) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * /*w  w  w.  j a  va 2s. c  om*/
 * Contributors:
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

public class Main {
    private static String formatTime(long dtNanos) {
        String x = "" + dtNanos;
        while (x.length() < 7) {
            x = "0" + x;
        }
        return x.substring(0, x.length() - 6) + "."
                + x.substring(x.length() - 6);
    }
}

Related

  1. formatTime(int time)
  2. formatTime(int time)
  3. formatTime(int value)
  4. formatTime(Integer hour, Integer minute, Integer second, Integer ampm, Integer zoneOffset)
  5. formatTime(Integer seconds)
  6. formatTime(long elapsedTime)
  7. formatTime(long elapsedTime)
  8. formatTime(long millis)
  9. formatTime(long millis)