Here you can find the source of format(long dateInMillis, String pattern)
public static String format(long dateInMillis, String pattern)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Oobium, Inc./*from ww w . ja v a 2s .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: * Jeremy Dowdall <jeremy@oobium.com> - initial API and implementation ******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String format(Date date, String pattern) { if (date == null) { return ""; } return new SimpleDateFormat(pattern).format(date); } public static String format(long dateInMillis, String pattern) { return new SimpleDateFormat(pattern).format(new Date(dateInMillis)); } }