commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-434) Add DateUtils.ceiling() method
Date Tue, 06 May 2008 09:45:56 GMT

    [ https://issues.apache.org/jira/browse/LANG-434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594537#action_12594537
] 

Robert Scholte commented on LANG-434:
-------------------------------------

I've had a look at the source, and it looks to me we need to use the private method modify
since it has a fix for [http://issues.apache.org/jira/browse/LANG-59], but then it's signature
has to be changed. 

{code}
    /**
     * <p>Internal calculation method.</p>
     * 
     * @param val  the calendar
     * @param field  the field constant
     * @param round  true to round, false to truncate
     * @throws ArithmeticException if the year is over 280 million
     */
private static void modify(Calendar val, int field, boolean round)
{code}

Just a suggestion:
{code}
    /**
     * <p>Internal calculation method.</p>
     * 
     * @param val  the calendar
     * @param field  the field constant
     * @param round  -1 to floor, 0 to round, 1 to ceil
     * @throws ArithmeticException if the year is over 280 million
     */
private static void modify(Calendar val, int field, int round)
{code}



> Add DateUtils.ceiling() method
> ------------------------------
>
>                 Key: LANG-434
>                 URL: https://issues.apache.org/jira/browse/LANG-434
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Travis Reeder
>             Fix For: 3.0
>
>
> It would be nice to have a DateUtils.ceiling methods which would be the opposite of truncate
(which is equivalent to floor)
> DateUtils.ceiling(Date d, int field);
> For example, if you had the datetime of 28 Mar 2002 13:45:01.231, if you passed with
HOUR, it would return 28 Mar 2002 13:59:59.999. If this was passed with MONTH, it would return
31 Mar 2002 23:59:59.999.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message