Here you can find the source of getFormattedTimeStamp(long timestamp, String formatString)
public static String getFormattedTimeStamp(long timestamp, String formatString)
//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)); } }