1/* 2****************************************************************************** 3* Copyright (C) 2007, International Business Machines Corporation and * 4* others. All Rights Reserved. * 5****************************************************************************** 6*/ 7 8package com.ibm.icu.impl.duration; 9 10import java.util.Date; 11import java.util.TimeZone; 12 13/** 14 * Abstract formatter for dates. Differs from DateFormat in that it 15 * provides <code>withLocale</code> and <code>withTimeZone</code> methods. 16 */ 17public interface DateFormatter { 18 19 /** 20 * Format the date, provided as a java Date object. 21 * 22 * @param date the date 23 * @return the formatted time 24 */ 25 String format(Date date); 26 27 /** 28 * Format the date, provided as milliseconds. 29 * 30 * @param date the date in milliseconds 31 * @return the formatted time 32 */ 33 String format(long date); 34 35 /** 36 * Returns a new DateFormatter that uses data for a new locale. 37 * 38 * @param locale the new locale to use 39 * @return a new formatter for the given locale 40 */ 41 DateFormatter withLocale(String localeName); 42 43 /** 44 * Returns a new DateFormatter that uses the new time zone. 45 * 46 * @param tz the new time zone 47 * @return a new formatter for the given time zone 48 */ 49 DateFormatter withTimeZone(TimeZone tz); 50} 51