info.aduna.text
Class DateTimeUtil
java.lang.Object
info.aduna.text.DateTimeUtil
public class DateTimeUtil
- extends Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateTimeUtil
public DateTimeUtil()
getNiceDateTimeString
public static String getNiceDateTimeString(long date)
- Converts the supplied 'date' to a Date object and call
getNiceDateTimeString(Date).
- See Also:
getNiceDateTimeString(long)
getNiceDateTimeString
public static String getNiceDateTimeString(Date date)
- Gets a "nice" human readable string for the supplied date. This method
distinguishes between the following situations:
- Dates for today; these are shown as time only (e.g.: 12:15
- Dates for yesterday; these are shown as "Yesterday" plus the time
(e.g. Yesterday 16:40
- Dates before yesterday but no older than half a year; these are
shown as a combination of month, day and time (e.g.: Aug 30 16:30
- Dates older than half a year or dates after today; these are shown
as a combination of year, month and day, but no time (e.g.: Jan 1,
2001).
getNiceDurationString
public static String getNiceDurationString(long duration)
- Gets a "nice" human readable string for the supplied duration. Example
results are:
- duration < 1 sec: 512ms
- 1 sec <= duration < 1 min: 34s
- 1 min <= duration < 1 hour: 45m
- 1 hour >= duration < 1 day: 4h
- duration > 1 day: 5d
- Parameters:
duration - A time in milliseconds
- Returns:
- A human readable string representing the duration.
Copyright © 1997-2008 Aduna. All Rights Reserved.