Here you can find the source of formatDate(long epochMillis)
Parameter | Description |
---|---|
epochMillis | a parameter |
public static String formatDate(long epochMillis)
//package com.java2s; /*/*from ww w.j a v a2 s .co m*/ * * * RHQ Management Platform * * Copyright (C) 2005-2012 Red Hat, Inc. * * All rights reserved. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation version 2 of the License. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ import java.text.DateFormat; import java.util.Date; public class Main { /** * Standard Date/time format for CSV files * @param epochMillis * @return String formatted string (i.e. '11/4/03') */ public static String formatDate(long epochMillis) { if (epochMillis != 0) { Date date = new Date(epochMillis); return DateFormat.getDateInstance(DateFormat.SHORT) .format(date); } else { return " "; } } }