Here you can find the source of toDate(final Long date, final String pattern)
public static String toDate(final Long date, final String pattern)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014, 2015 Red Hat.//from ww w. j ava 2 s .c o m * 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: * Red Hat - Initial Contribution *******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String toDate(final Long date, final String pattern) { final long millis = Long.valueOf(date).longValue() * 1000; final Date d = new Date(millis); final SimpleDateFormat sdf = new SimpleDateFormat(pattern); //$NON-NLS-1$ return sdf.format(d); } public static String toDate(final Date date, final String pattern) { final SimpleDateFormat sdf = new SimpleDateFormat(pattern); //$NON-NLS-1$ return sdf.format(date); } }