Java Timestamp Format getFormattedTimeStamp(long timestamp, String formatString)

Here you can find the source of getFormattedTimeStamp(long timestamp, String formatString)

Description

get Formatted Time Stamp

License

Open Source License

Declaration

public static String getFormattedTimeStamp(long timestamp, String formatString) 

Method Source Code

//package com.java2s;
/*/*from   ww  w  .  j a  v a2  s .  c  o  m*/
 * Copyright (c) 2015 Cisco Systems Inc. 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
 */

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static String getFormattedTimeStamp(long timestamp, String formatString) {
        Date date = new Date(timestamp);
        DateFormat formatter = new SimpleDateFormat(formatString, Locale.US);
        return (formatter.format(date));
    }
}

Related

  1. getFormattedDateFromTimestamp(long timestamp)
  2. getFormattedTime(long timestamp, String format)
  3. getFormattedTimestamp()
  4. getFormattedTimestamp(@Nonnull Date date)
  5. getFormattedTimestamp(File file)
  6. getFullTimestampFormatter(Locale locale)
  7. getTimestamp(boolean useTwentyFourFormat)
  8. getTimeStamp(String format)
  9. getTimestamp(String format)