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