You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/05/17 07:47:06 UTC
[jira] Closed: (LANG-194) [lang] add generic add method to
DateUtils
[ http://issues.apache.org/jira/browse/LANG-194?page=all ]
Henri Yandell closed LANG-194:
------------------------------
> [lang] add generic add method to DateUtils
> ------------------------------------------
>
> Key: LANG-194
> URL: http://issues.apache.org/jira/browse/LANG-194
> Project: Commons Lang
> Type: Improvement
> Environment: Operating System: Windows XP
> Platform: PC
> Reporter: David Bowers
> Priority: Minor
> Fix For: 2.2
>
> There is no way to do Date arithmetic in one line in Java, unless you use
> deprecated methods. The following method initializes a Calendar object with a
> date and performs date arithmetic on it, and returns the result as a java.util.Date.
> public static Date add(Date date, int field, int amount) {
> Calendar c = new GregorianCalendar();
> c.setTime(date);
> c.add(field, amount);
> return c.getTime();
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org