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