Linked Questions

1 vote
4 answers
7k views

I am developing a interest calculator in C#. I need to know the number of days between 2 dates So, I am calculating something like this : DateTime dt1 = DateTime.ParseExact(DateTime.Now.Date....
Kiran's user avatar
  • 8,578
0 votes
4 answers
2k views

Possible Duplicates: How to get difference between two dates in Year/Month/Week/Day? Difference in months between two dates (C#, .NET) Hi I'm a novice at c# and I need to find out the age of a ...
Waynelee3d's user avatar
0 votes
3 answers
434 views

I have 2 dates as integers. How can i find the month difference between these two integers in c#? For example: Int32 beginDate= 20130307(yyyymmdd) Int32 beginDate= 20140507(yyyymmdd) I need the ...
user3661657's user avatar
-1 votes
2 answers
273 views

The need is to keep track of the current season (as an integer) of a game, that increments by one at every 1st of a month. How is it possible at runtime to count the amount of times it has been the ...
Jesper's user avatar
  • 3
-1 votes
1 answer
100 views

I've a little question. How I can calculate the months between the current month and another given month? For example: now it's February, I want to know, how many months are between February and let's ...
Marcel Hoffmann's user avatar
1 vote
0 answers
73 views

Any help would be appreciated. I have a company that calculates interest where if they have a property for one day in the month of June by July 1st even though it's only been 2 days they get the ...
ksuProgrammer's user avatar
0 votes
0 answers
73 views

I have two dates viz startDate and endDate. I want to calculate the exact number of days and months between these dates including the endDate. The scenario is I am disabling the dates prior to today ...
user3034944's user avatar
  • 1,801
0 votes
1 answer
34 views

System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.InvariantCulture; DateTime dTDoJ = DateTime.ParseExact("07/01/2017", "MM/dd/yyyy", ci); int months = Math.Abs((DateTime.Now....
Ghaffar Hunzai's user avatar
53 votes
23 answers
117k views

How to get difference between two dates in Year/Month/Week/Day in an efficient way? eg. difference between two dates is 1 Year, 2 Months, 3 Weeks, 4 Days. Difference represents count of year(s), ...
Ahmed Atia's user avatar
12 votes
2 answers
32k views

I would like to know how to calculate the numbers of Month between two dates. Is there any method to calculate it in C#? Eg1. Date1 = "2011/11/01" Date2 = "2012/02/01" Result. ...
lelewin's user avatar
  • 559
4 votes
2 answers
11k views

I am doing this datediff = (date1 - DateOfDeposit).TotalDays; But this gives the no. of days and I want no.of months.
James's user avatar
  • 170
1 vote
6 answers
12k views

i want to subtract previous date from current date. previous date may be 2 months and 15 days or 1 year 9 month and 10 days... like this etc... So please how can i write the Coding in C#. thanks a lot....
user1578422's user avatar
1 vote
5 answers
2k views

how can I calculate if a date (in DateTime format) is 6 month later or not from my BirthDate (in DateTime format)?
DuffDan's user avatar
  • 31
2 votes
3 answers
8k views

I need to convert the number of days into years, months, days. Example: A Employee Experience to be calculated as per his Date of join(DOJ) and date of Relieve(DOR). We have a DOJ, DOR and Number of ...
Sankar's user avatar
  • 7,177
4 votes
5 answers
140 views

I was wondering how I can get the difference between two dates in complete hours e.g. DateTime date1 = DateTime.Now; DateTime date2 = new DateTime(2011, 8, 5, 33,00); long hours = date1 - date2;
David Filo's user avatar

15 30 50 per page