org.davesag.generica.util
Class DateUtils
java.lang.Object
org.davesag.generica.util.DateUtils
- public class DateUtils
- extends Object
A collection of static utility methods for doing things with
Date s.
- Since:
- Generica 1.0
- Version:
- CVS Revision $Id: DateUtils.java,v 1.5 2004/03/30 10:12:59 norm Exp $
- Author:
- Dave Sag
http://www.davesag.com
|
Method Summary |
static int |
daysUntil(Date d)
computes the number of whole days until the date supplied. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateUtils
public DateUtils()
daysUntil
public static int daysUntil(Date d)
- computes the number of whole days until the date supplied. This is not
very accurate right now, and should only be used for'near enough'
calculations.
The actual code used is as follows: see if you can improve on it.
Math.ceil((d.getTime() - (new Date()).getTime())/DAY_MULTIPLIER);
- Parameters:
d - The date.
- Returns:
- a whole number of days from now until the date supplied.
Dave Sag Generica API version 0.5.9 - (prerelease) Copyright © 2003 - 2004 Dave Sag.