TimeSpan Class

Defines the structure for an object that represents a time interval that is typically added to, or subtracted from, a DateTime value.

Example

The following calculates and displays a new time that is 3 hours, 20 minutes, and 12 seconds greater than the current time:

using elsystem;
var: DateTime newTime(null);
newTime = DateTime.Now + TimeSpan.Create(3,20,12);
print("Current Time: ",DateTime.Now.tostring(),"  New Time: ",newTime.tostring());

Namespace: elsystem

Properties
  Name Type Description
Public property Days int Gets the number of days in the time interval.
Public property Hours int Gets the number of hours in the time interval.
Public property Milliseconds int Gets the number of milliseconds in the time interval.
Public property Minutes int Gets the number of minutes in the time interval.
Public property Seconds int Gets the number of seconds in the time interval.
Public property TotalDays double Gets the value of the timespan in whole and fractional days.
Public property TotalHours double Gets the value of the timespan in whole and fractional hours.
Public property TotalMilliseconds double Gets the value of the timespan in whole and fractional milliseconds.
Public property TotalMinutes double Gets the value of the timespan in whole and fractional minute.
Public property TotalSeconds double Gets the value of the timespan in whole and fractional seconds.
Methods
  Name Description
Public property Create Initializes an instance of the class.
Public property Create(h,m,s) Initializes an instance with the specified hours, minutes, and seconds parameters.
Public property Create(d,h,m,s) Initializes an instance with the specified days, hours, minutes, and seconds parameters.
Public property Create(d,h,m,s,ms) Initializes an instance with the specified days, hours, minutes, seconds, and milliseconds parameters.
Public property FromELDateAndTime(ELTime,seconds) Converts legacy EL time values and additional seconds to a TimeSpan equivalent.
Public property ToString() Converts the TimeSpan value to a string.