Here you can find the source of format(long timeMillis)
Parameter | Description |
---|---|
timeMillis | a parameter |
public static String format(long timeMillis)
//package com.java2s; /*/*from w w w . ja va 2 s.co m*/ * $RCSfile: GMTUtil.java,v $$ * $Revision: 1.1 $ * $Date: 2007-5-29 $ * * Copyright (C) 2008 Skin, Inc. All rights reserved. * * This software is the proprietary information of Skin, Inc. * Use is subject to license terms. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { private static String EMPTY = ""; private static String DATE_FORMAT_GMT = "EEE, dd MMM yyyy HH:mm:ss z"; private static Locale local = Locale.ENGLISH; private static TimeZone timeZone = TimeZone.getTimeZone("GMT"); /** * @param timeMillis * @return String */ public static String format(long timeMillis) { DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT, local); dateFormat.setTimeZone(timeZone); return dateFormat.format(new Date(timeMillis)); } /** * @param date * @return String */ public static String format(Date date) { DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT, local); dateFormat.setTimeZone(timeZone); return (date != null ? dateFormat.format(date) : EMPTY); } }