The i18n Cookbook - recipies for a global society

  • java cookbook
  • about the author
Home

Java Cookbook

  • Java Internationalization Cookbook

date format

Format a time interval

Problem:

You want to format a span of time.

Solution:

As of version 4, icu4j contains a DateIntervalFormat class.  This class makes it relatively easy to format an interval value.  The format will automatically format as compactly as possible. For example: if the difference between the two dates is only a few hours and both dates occur on the same day, the year, month, and day parts of the date will be omitted.

 

  • date format
  • Add new comment
  • Read more

Dates and Times

Calendars and date formatting are central to a properly internationalized application.  Java provides several classes that are very useful to the localization developer for handling dates and times. 
 
Java's Calendar class and its sub-classes handle the complex date calculations that go with Chinese, Islamic, Hebrew, and Gregorian calendars, as well as a number of others.
 
Java's DateFormat class handles formatting dates and times in a locale appropriate manner.
 

  • calendar
  • date format
  • icu4j
  • Java
  • Add new comment
  • Read more

If you are testing any of these recipes in Eclipse and the characters are not displaying correctly in your console visit http://i18ncookbook.com/eclipse_settings.

This site is ad supported.  I hope you find something among our sponsors worth clicking. ;)

i18n search

Google
Custom Search
Syndicate content

Search

Tags in Tags

calendar date icu4j Java Locale number format numberformat parse spellout timezone transliteration transliterator
more tags

User login

  • Create new account
  • Request new password
  • java cookbook
  • about the author