TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Calculate month between two date
Hiren Soni
Aug 20, 2010
4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Calculate month between two date
DateTime d1 = new DateTime(2002, 1, 1);
DateTime d2 = new DateTime(2000, 10, 1);
int M = Math.Abs((d1.Year - d2.Year));
int months = ((M * 12) + Math.Abs((d1.Month - d2.Month)));
Calculate month between two date
Next Recommended Reading
Keeping up to date