Here you can find the source of format(Calendar current)
Parameter | Description |
---|---|
current | the current |
public static String format(Calendar current)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /** The Constant UTC_TIME_ZONE. */ public final static TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone("UTC"); /** The Constant DATE_TIME_PATTERN. */ public final static String DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'"; /**/*from w w w.ja v a 2 s.c o m*/ * Format the date. * * @param date the date * @return the formated date */ public static String format(Date date) { DateFormat df = getThreadLocalDateFormat(); return df.format(date); } /** * Format the date. * * @param current the current * @return the string */ public static String format(Calendar current) { return format(current.getTime()); } /** * Gets the thread local date format. * * @return the thread local date format */ private static DateFormat getThreadLocalDateFormat() { DateFormat result = new SimpleDateFormat(DATE_TIME_PATTERN); result.setTimeZone(UTC_TIME_ZONE); return result; } }