MfTimeSpan

Namespace ›› System ››
Parent Previous Next

MfTimeSpan Class

(Inherits from MfPrimitive)

A MfTimeSpan object represents a time interval (duration of time or elapsed time) that is measured as a positive or negative number of days, hours, minutes, seconds, and fractions of a second. The MfTimeSpan object can also be used to represent the time of day, but only if the time is unrelated to a particular date.

The largest unit of time that the MfTimeSpan object uses to measure duration is a day. Time intervals are measured in days for consistency, because the number of days in larger units of time, such as months and years, varies.

The value of a MfTimeSpan object is the number of ticks that equal the represented time interval. A tick is equal to 100 nanoseconds, or one ten-millionth of a second. The value of a MfTimeSpan object can range from MfTimeSpan.MinValue to MfTimeSpan.MaxValue.

Links

Fields, Properties, Methods, Example

Constructors


Name

Description

Constructor()

Initializes a new instance of the MfTimeSpan structure.

Constructor(ts)

Initializes a new instance of the MfTimeSpan structure to the specified number of ticks of ts.

Constructor(ticks)

Initializes a new instance of the MfTimeSpan structure to the specified number of ticks.

Constructor(hours, minutes, seconds)

Initializes a new instance of the MfTimeSpan structure to a specified number of hours, minutes, and seconds.

Constructor(days, hours, minutes, seconds)

Initializes a new instance of the MfTimeSpan structure to a specified number of days, hours, minutes, and seconds.

Constructor(days, hours, minutes, seconds, milliseconds)

Initializes a new instance of the MfTimeSpan structure to a specified number of days, hours, minutes, seconds and milliseconds.

Fields


Name

Description

MaxValue

Gets the maximum MfTimeSpan value

MinValue

Gets the minimum MfTimeSpan value.

TicksPerDay

Gets the number of ticks in 1 day as instance of MfInt64.

TicksPerHour

Gets the number of ticks in 1 hour as instance of MfInt64.

TicksPerMillisecond

Gets the number of ticks in 1 millisecond as instance of MfInt64.

TicksPerMinute

Gets the number of ticks in 1 minute as instance of MfInt64.

TicksPerSecond

Gets the number of ticks in 1 second as instance of MfInt64.

Zero

Gets the zero MfTimeSpan value as instance of MfTimeSpan

Properties


Name

Description

Days

Gets the days component of the time interval represented by the current MfTimeSpan object as MfInteger object.

Hours

Gets the hours component of the time interval represented by the current MfTimeSpan object as MfInteger object.

Milliseconds

Gets the milliseconds component of the time interval represented by the current MfTimeSpan object as MfInteger object.

Minutes

Gets the minutes component of the time interval represented by the current MfTimeSpan class as MfInteger object.

Seconds

Gets the seconds component of the time interval represented by the current MfTimeSpan object as MfInteger object.

Ticks

Gets the number of ticks that represent the value of the current MfTimeSpan object as MfInt64 object.

TotalDays

Gets the value of the current MfTimeSpan object expressed in whole and fractional days as MfFloat object.

TotoaHours

Gets the value of the current MfTimeSpan object expressed in whole and fractional hours as MfFloat object.

TotalMilliseconds

Gets the value of the current MfTimeSpan object expressed in whole and fractional milliseconds as MfFloat object.

TotalMinutes

Gets the value of the current MfTimeSpan object expressed in whole and fractional minutes as MfFloat object.

TotalSeconds

Gets the value of the current MfTimeSpan object expressed in whole and fractional seconds as MfFloat object.

Value

Gets or sets the value associated with the this instance of MfTimeSpan. Overrides MfPrimitive.Value.

Methods


Name

Description

Add(ts)

Returns a new MfTimeSpan object whose value is the sum of the specified MfTimeSpan object and this instance.

Compare(t1, t2)

Compares two MfTimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.

CompareTo(obj)

Compares the current instance with another object of the same type and returns an Integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.. Overrides MfObject.CompareTo()

Duration()

Returns a new MfTimeSpan object whose value is the absolute value of the current MfTimeSpan object.

Equals(value)

Compares objects to see if they are the same. Overrides MfObject.Equals()

Equals(objA, objB)

Compares objects to see if they are the same.

FromDays(value)

Returns a MfTimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.

FromHours(value)

Returns a MfTimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.

FromMilliseconds(value)

Returns a MfTimeSpan that represents a specified number of milliseconds, where the specification is accurate to the nearest millisecond.

FromMinutes(value)

Returns a MfTimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.

FromSeconds(value)

Returns a MfTimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest minutes.

FromTicks(value)

Returns a MfTimeSpan that represents a specified time, where the specification is in units of ticks.

GetHashCode()

Gets A hash code for the MfTimeSpan instance. Overrides MfObject.GetHashCode()

GetType()

Gets the Type for the for the Class .Inherited from MfObject.

Is(type)

Gets if current instance of object is of the same type. Inherited from MfObject. Inherited from MfObject.

IsInstance()

Get if the current class is an instance. Inherited from MfObject.

MemberwiseClone()

Creates a shallow copy of the current MfObject instance. Inherited from MfObject.

Negate()

Returns a new MfTimeSpan object whose value is the negated value of this instance.

Parse(str)

Converts the string representation of a time interval to its MfTimeSpan equivalent.

Subtract(ts)

Returns a new MfTimeSpan object whose Value is the difference between the specified MfTimeSpan instance and this instance.

ToString()

Gets a string representation of the current instance of MfTimeSpan.. Overrides MfPrimitive.ToString()

TryParse(result, s)

Converts the string representation of a time interval to its MfTimeSpan equivalent and returns a value that indicates whether the conversion succeeded.

Example

span := new MfTimeSpan(MfTimeSpan.Zero)
MsgBox % span.ToString() ; Displays: 00

span := new MfTimeSpan(5624853448000)
MsgBox % span.ToString() ; Displays: 06.12:14:45.3448000

span := new MfTimeSpan(7, 14, 0)
MsgBox % span.ToString() ; Displays: 07:14:00

span := new MfTimeSpan(7, 14, 17)
MsgBox % span.ToString() ; Displays: 07:14:17

span := new MfTimeSpan(7, 14, 17, 41)
MsgBox % span.ToString() ; Displays: 07.14:17:41

span := new MfTimeSpan(7, 14, 17, 41, 243)
MsgBox % span.ToString() ; Displays: 07.14:17:41.2430000

iHour := new MfInteger(14)
iMin  := new MfInteger(57)
iSec  := new MfInteger(29)
span  := new MfTimeSpan(iHour, iMin, iSec)
MsgBox % span.ToString() ; Displays: 14:57:29