You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2008/05/02 19:34:55 UTC

[jira] Commented: (LANG-434) Add DateUtils.ceiling() method

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

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

If you follow java's Math-api, it would be DateUtils.ceil(Date d, int field) and not ceiling.
And ceil would give you the next full value, which means you need to add that last millisecond.

Following your examples:
if you had the datetime of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000. 
If this was passed with MONTH, it would return 1 Apr 2002 00:00:00.000.



> 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
>
> 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.