It's not clear in the java doc what the difference between DateUtils.ceiling and DateUtils.truncate is. Is the java doc wrong? Can someone clarify this?
ceiling
public static Date ceiling(Date date,
int field)
Ceil this date, leaving the field specified as the most significant 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:00:00.000. If this was
passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
vs
truncate
public static Date truncate(Date date,
int field)
Truncate this date, leaving the field specified as the most
significant 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:00:00.000.
If this was passed with MONTH, it would return 1 Mar 2002 0:00:00.000.
No comments:
Post a Comment