0

I am looking for how it is possible to calculate the difference in minutes for a date and time.

This example will cover the problem.

20091118 18:15
20091125 01:35

I know this is possible using Date functions and TimeSpan but trying to find examples but cant find an example of this problem.

I will be happy to solve this.

Thank you!

Edited by Darth Vader: n/a

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by Darth Vader
0

Subtract two dates.

DateTime d1 = DateTime.Parse("11/18/2009 18:15");
  DateTime d2 = DateTime.Parse("11/25/2009 01:35");

  TimeSpan ts = d2 - d1;
  Console.WriteLine("Seconds : {0} Minutes : {1}", ts.TotalSeconds, ts.TotalMinutes);
0

Thank you, that worked very well.

Subtract two dates.

DateTime d1 = DateTime.Parse("11/18/2009 18:15");
  DateTime d2 = DateTime.Parse("11/25/2009 01:35");

  TimeSpan ts = d2 - d1;
  Console.WriteLine("Seconds : {0} Minutes : {1}", ts.TotalSeconds, ts.TotalMinutes);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.