2 ******************************************************************************
\r
3 * Copyright (C) 2007, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 ******************************************************************************
\r
8 package com.ibm.icu.impl.duration;
\r
10 import java.util.Date;
\r
11 import java.util.TimeZone;
\r
14 * Abstract formatter for dates. Differs from DateFormat in that it
\r
15 * provides <code>withLocale</code> and <code>withTimeZone</code> methods.
\r
17 public interface DateFormatter {
\r
20 * Format the date, provided as a java Date object.
\r
22 * @param date the date
\r
23 * @return the formatted time
\r
25 String format(Date date);
\r
28 * Format the date, provided as milliseconds.
\r
30 * @param date the date in milliseconds
\r
31 * @return the formatted time
\r
33 String format(long date);
\r
36 * Returns a new DateFormatter that uses data for a new locale.
\r
38 * @param locale the new locale to use
\r
39 * @return a new formatter for the given locale
\r
41 DateFormatter withLocale(String localeName);
\r
44 * Returns a new DateFormatter that uses the new time zone.
\r
46 * @param tz the new time zone
\r
47 * @return a new formatter for the given time zone
\r
49 DateFormatter withTimeZone(TimeZone tz);
\r