Java Timestamp Format format(long timeStamp)

Here you can find the source of format(long timeStamp)

Description

Formats a numeric timestamp into a textual representation.

License

Open Source License

Parameter

Parameter Description
timeStamp a parameter

Return

a string representation of the timestamp

Declaration

public static String format(long timeStamp) 

Method Source Code

//package com.java2s;
/*//from   w w w .ja v a 2 s.  c  o  m
 * Copyright (c) 2004-2005 Universite de Nantes (LINA)
 * Copyright (c) 2005-2006 France Telecom
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: Pierre-Charles David <pcdavid@gmail.com>
 */

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

public class Main {
    /**
     * The textual format used to represent timestamps. Conforms to ISO 8601.
     */
    private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");

    /**
     * Formats a numeric timestamp into a textual representation.
     * 
     * @param timeStamp
     * @return a string representation of the timestamp
     */
    public static String format(long timeStamp) {
        return FORMAT.format(new Date(timeStamp));
    }
}

Related

  1. format(Date timestamp, String format)
  2. Format(DateFormat format, Timestamp time)
  3. format(final Date date)
  4. format(final long unixTimeStamp)
  5. format(long timestamp)
  6. format(Timestamp time)
  7. format2AdwordsTimestamp(Date date)
  8. format8chars(long timestamp)
  9. formataDataHoraMinuto(Timestamp dataHora)