jrmcdona
asked on
subtracting from the current date
I have a date value and I need to subract it from the current date(DateTime.Now). Which is a timespan value so therefore this calculation is not working.
MyTime = a datetime value from my database.
I need to subract:
NewTime = DateTime.Now - MyTime;
I cannot seem to figure out how to get this to work!
any help would be great!
thanks Jordan
MyTime = a datetime value from my database.
I need to subract:
NewTime = DateTime.Now - MyTime;
I cannot seem to figure out how to get this to work!
any help would be great!
thanks Jordan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DateTime date1 = MyTime;
TimeSpan diff1 = date2.Subtract(date1);