Java Long Number to Date formatDate(long absTime)

Here you can find the source of formatDate(long absTime)

Description

From input time in nanoseconds, convert to Date format YYYY-MM-dd

License

Open Source License

Parameter

Parameter Description
absTime a parameter

Declaration

public static String formatDate(long absTime) 

Method Source Code

//package com.java2s;
/*****************************************************************************
 * Copyright (c) 2007, 2008 Intel Corporation and others.
 * 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
 *
 * Contributors:/*from ww w.j  a v a 2 s  . c o  m*/
 *    Intel Corporation - Initial API and implementation
 *    Ruslan A. Scherbakov, Intel - Initial API and implementation
 *    Alvaro Sanchex-Leon - Udpated for TMF
 *
 * $Id: Utils.java,v 1.11 2008/06/16 21:04:49 jkubasta Exp $ 
 *****************************************************************************/

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    static private final SimpleDateFormat sdateformat = new SimpleDateFormat("yyyy-MM-dd");

    /**
     * From input time in nanoseconds, convert to Date format YYYY-MM-dd
     * 
     * @param absTime
     * @return
     */
    public static String formatDate(long absTime) {
        String sdate = sdateformat.format(new Date((long) (absTime * 1E-6)));
        return sdate;
    }
}

Related

  1. format(long time, SimpleDateFormat format)
  2. formatDate(final long date)
  3. formatDate(final long ticks, final SimpleDateFormat format)
  4. formatDate(final long time)
  5. formatDate(final long timestamp)
  6. formatDate(long d)
  7. formatDate(long d)
  8. formatDate(long date)
  9. formatDate(Long date)