You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/02/04 13:44:49 UTC
DO NOT REPLY [Bug 26659] New: -
[lang] add method to DateUtils to get the distance between 2 dates
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26659>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26659
[lang] add method to DateUtils to get the distance between 2 dates
Summary: [lang] add method to DateUtils to get the distance
between 2 dates
Product: Commons
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Enhancement
Priority: Other
Component: Lang
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: Maarten.Coene@qmedit.com
Hi,
I would like to see a method added to DateUtils that calculates the distance for
a specific field between 2 dates. What do I mean by this:
for instance:
* the distance between 01 Jan 2003 and 01 Feb 2003 is: 0 years, 1 month, 31
days, 744 hours, ...
* the distance between 01 Jan 2003 and 01 Feb 2004 is: 1 years, 13 month, ...
* the distance between 01 Jan 2004 and 01 Jan 2005 is: 1 year, 12 month, 366
days (leap year!), ...
The proposed methods are:
public static long distance(Date date1, Date date2, int dateField);
public static long distance(Calendar c1, Calendar c2, int dateField);
attached are patches for DateUtils and DateUtilsTest.
Maarten
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org