All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ibm.icu.impl.duration.DurationFormatter Maven / Gradle / Ivy

Go to download

Vaadin is a web application framework for Rich Internet Applications (RIA). Vaadin enables easy development and maintenance of fast and secure rich web applications with a stunning look and feel and a wide browser support. It features a server-side architecture with the majority of the logic running on the server. Ajax technology is used at the browser-side to ensure a rich and interactive user experience.

There is a newer version: 1.2.0
Show newest version
/*
******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and   *
* others. All Rights Reserved.                                               *
******************************************************************************
*/

package com.ibm.icu.impl.duration;

import java.util.Date;
import java.util.TimeZone;

/**
 * Formatter for durations in milliseconds.
 */
public interface DurationFormatter {

  /**
   * Formats the duration between now and a target date.
   * 

* This is a convenience method that calls * formatDurationFrom(long, long) using now * as the reference date, and the difference between now and * targetDate.getTime() as the duration. * * @param targetDate the ending date * @return the formatted time */ String formatDurationFromNowTo(Date targetDate); /** * Formats a duration expressed in milliseconds. *

* This is a convenience method that calls formatDurationFrom * using the current system time as the reference date. * * @param duration the duration in milliseconds * @param tz the time zone * @return the formatted time */ String formatDurationFromNow(long duration); /** * Formats a duration expressed in milliseconds from a reference date. *

* The reference date allows formatters to use actual durations of * variable-length periods (like months) if they wish. *

* The duration is expressed as the number of milliseconds in the * past (negative values) or future (positive values) with respect * to a reference date (expressed as milliseconds in epoch). * * @param duration the duration in milliseconds * @param referenceDate the date from which to compute the duration * @return the formatted time */ String formatDurationFrom(long duration, long referenceDate); /** * Returns a new DurationFormatter that's the same as this one * but formats for a new locale. * * @param localeName the name of the new locale * @return a new formatter for the given locale */ DurationFormatter withLocale(String localeName); /** * Returns a new DurationFormatter that's the same as this one but * uses a different time zone. * * @param tz the time zone in which to compute durations. * @return a new formatter for the given locale */ DurationFormatter withTimeZone(TimeZone tz); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy