Here you can find the source of format(Date date)
Parameter | Description |
---|---|
date | the date |
public static String format(Date date)
//package com.java2s; /*/*from ww w .j a va2 s . co m*/ * Copyright 2008-2014, David Karnok * The file is part of the Open Imperium Galactica project. * * The code should be distributed under the LGPL license. * See http://www.gnu.org/licenses/lgpl.html for details. */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /** The date formatter. */ public static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() { @Override protected SimpleDateFormat initialValue() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); sdf.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"))); return sdf; } }; /** * Format a date object. * @param date the date * @return the string representation */ public static String format(Date date) { return DATE_FORMAT.get().format(date); } }