PDA

Click to See Complete Forum and Search --> : How long until a given date


rockies1
Apr 26th, 2010, 08:36 AM
I am trying to figure out how to determine how many days until a given date from today.

For example, if today is 4/26 and I need to know how long until 5/17, I need to know that it is 21 days.

But if I need to know how long until 1/21, I'd need to know 270.

Basically, I'm looking for the number of days from today to the next occurrence of a give MM/DD combo regardless of year.

Thanks!

tsaunders
Apr 26th, 2010, 09:47 AM
Have you looked at the DateDiff?

http://msdn.microsoft.com/en-us/library/ms189794.aspx

rockies1
Apr 26th, 2010, 11:34 AM
I'm looking for a Java solution, not an SQL solution, but thanks.

tsaunders
Apr 26th, 2010, 11:42 AM
Sorry about that, should have looked which section I was in.

Have you tried this:

http://www.java2s.com/Code/Java/Development-Class/DateDiffcomputethedifferencebetweentwodates.htm

rockies1
Apr 26th, 2010, 01:37 PM
That helped greatly, THANK YOU!