I would like to subtract seconds from a date, for example:
Lets say I have 1300 seconds in a unsigned integer, I would like to take the current date and time, subtract 1,300 seconds from it, and end up with:
01/13/2012 2:15 PM (format doesn’t really matter).
I did try:
DateTime dt = new DateTime();
dt.Add(new TimeSpan(0, 0, ui.OnlineTime));
Online.Text = dt.ToLongDateString();
AddSeconds(double value)method ofDateTimetakes positive and negative number of seconds:Hence, to subtract 1300 seconds you need to add -1300 seconds: