Hi all,

What's the fastest and cleanest way of checking whether a DateTime
object occurred today?  Right now, I have the following, but I'm
wondering if there's something more efficient.

  private static boolean today(DateTime dateTime) {
    DateTime now = new DateTime();

    return (dateTime.getYear() == now.getYear() &&
            dateTime.getMonthOfYear() == now.getMonthOfYear() &&
            dateTime.getDayOfMonth() == now.getDayOfMonth());
  }

Thanks!

Ryan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to