Subtracting seconds from Datetime

  • Thread starter Thread starter Paulers
  • Start date Start date
P

Paulers

hello all,

how does one go about subtracting seconds from a DateTime object?

for example I have a date time of "06/04/2007 10:31" and I need to
subtract 12 seconds from that.

all help is greatly appreciated.
 
Try code similar to the following to get a time 12 seconds before right now:

Dim newDate As DateTime = Now.AddSeconds(-12)
 
hello all,

how does one go about subtracting seconds from a DateTime object?

for example I have a date time of "06/04/2007 10:31" and I need to
subtract 12 seconds from that.

all help is greatly appreciated.

You can use .Subtract (and pass in a Timespan object) or .Add with a
negative value.

i.e. SomeDateHere.Add(-12) OR SomeDateHere.Subtract(New Timespan(0,0,12))
 
Back
Top