Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetDays between Dates?

Status
Not open for further replies.

need2progm

Programmer
Dec 13, 2002
92
US
I have 4 "TimeSlices" Annual, Quarterly, Weekly, Daily.

Given a time slice and 2 dates (BeginDate as Date, and EndDate as Date) I need to come up with the number of occurrences.

Example ...
BeginDate = 1/1/2004
EndDate = 2/15/2005

Switch TimeSliceType
Case Annual
Count = EndDate.Year - BeginDate.Year
Case Montly
Case Weekly
Case Daily

Does .Net have any cool functions to help me out with this?

Thanks in Advance for your help!
 
look at datediff

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Doing subtraction on DateTime objects results in a TimeSpan object. The TimeSpan object has properties for days, months, etc.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top