I need the same logic.. Is it something you can share/ post to the
bugzilla?
Eric
-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
Sent: Tuesday, March 01, 2005 11:43 AM
To: Commons Developer
Subject: [lang] Addition for DataUtils
Hello... I just had to whip up a function that might be useful...
The situation was that I needed to determine if the current time fell
within a given range. The complication is that the range could span a
day, i.e., the range might be 2000-0800 (24 hr. times).
So I threw together
static boolean isTimeInRange(int rangeStart, int rangeEnd, int
timeToCheck);
...the idea being that someone would do something like:
int now = 100 * new GregorianCalendar().get(Calendar.HOUR_OF_DAY);
if (isTimeInRange(800, 2000, now)) {
// in range
}
I'm wondering if that sounds like a good edition to DateUtils?
If so, I'll create some overloaded versions (to accept actual Calendars
and probably Strings in addition to ints, and mixtures of all three,
perhaps 12-hour times too), solidify and clean up the code, throw
together a unit test and post it to Bugzilla.
Any thoughts? Part of me expects to hear this already exists somewhere,
but I didn't find it in DateUtils, which strikes me as the logical
place. Thanks all!
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
|