Here you can find the source of formatDateForLog(long dateTs)
public static String formatDateForLog(long dateTs)
//package com.java2s; /******************************************************************************* * Copyright ? 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String LOG_TS_FORMAT = "yyyyMMdd_HH:mm:ss"; public static String formatDateForLog(long dateTs) { return formatDate(dateTs, LOG_TS_FORMAT); }// w w w. j av a 2s . com public static String formatDate(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } public static String formatDate(long dateTs, String format) { return formatDate(new Date(dateTs), format); } }