C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






AddDays method of a DateTime object


Posted Date: 19 Jun 2008    Resource Type: Code Snippets    Category: Date & Time

Posted By: Ashokkumar       Member Level: Silver
Rating:     Points: 5



This code snippet describes how to find the next month day after the given DateTime. That can be very useful, for example, if you want to find the next 15th day or so after a specific date.


///
/// Returns the next month day after the given DateTime.
///

/// Source DateTime
/// Target month day
/// DateTime
public DateTime NextHigherMonthDay(DateTime T, int D) {
return ((T.Day >= D) ? T.AddMonths(1) : T).AddDays(D-T.Day);
}

// With a minor change, you can create related functions like
// the one below. I just changed the ">=" to ">" ...
public DateTime NextHigherOrEqualMonthDay(DateTime T, int D)
{
return ((T.Day > D) ? T.AddMonths(1) : T).AddDays(D - T.Day);
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Next month day after the given DateTime  .  DateTime object's AddDays method  .  AddDays method of a DateTime object  .  AddDays method of a DateTime  .  AddDays method  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Compare Dates in JavaScript
Previous Resource: How to compare Dates.
Return to Discussion Resource Index
Post New Resource
Category: Date & Time


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use