c#: how do i subtract two dates?

Posted by every_answer_gets_a_point on Stack Overflow See other posts from Stack Overflow or by every_answer_gets_a_point
Published on 2010-04-12T19:14:58Z Indexed on 2010/04/12 19:22 UTC
Read the original article Hit count: 326

Filed under:
|

here's my code:

DateTime date1 = new DateTime(byear, bmonth, bday, 0, 0, 0);
DateTime datenow =  DateTime.Now;
DateTime date2 = datenow - date1

on the last line i am getting Error 1 Cannot implicitly convert type 'System.TimeSpan' to 'System.DateTime'

ow do i subtract two dates?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms