Constructor()

Namespace ›› System ›› MfTimeSpan ›› Methods ››
Parent Previous Next

Constructor()

Initializes a new instance of the MfTimeSpan structure.

OutputVar := new MfTimeSpan()
OutputVar := new MfTimeSpan(ts)
OutputVar := new MfTimeSpan(ticks)
OutputVar := new MfTimeSpan(hours, minutes, seconds)
OutputVar := new MfTimeSpan(days, hours, minutes, seconds)
OutputVar := new MfTimeSpan(days, hours, minutes, seconds, milliseconds)

Constructor()

Initializes a new instance of the MfTimeSpan structure.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of 0

Constructor(ts)

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

Parameters

ts

An instance of MfTimeSpan.

Throws MfArgumentOutOfRangeException if the parameters specify a MfTimeSpan value less than MinValue or greater than MaxValue.
Throws MfArgumentException if there is an error get a value from a parameter.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of ts
Eg: myTs := new MfTimeSpan(MfTimeSpan.Zero)

Constructor(ticks)

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

Parameters

ticks

A time period expressed in 100-nanosecond units. Can be instance of MfInt64 or var containing integer.

Throws MfArgumentOutOfRangeException if the parameters specify a MfTimeSpan value less than MinValue or greater than MaxValue.
Throws MfArgumentException if there is an error get a value from a parameter.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of ticks
A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond.

Constructor(hours, minutes, seconds)

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

Parameters

hours

Number of hours. Can be instance of MfInteger or var containing integer.

minutes

Number of Minutes. Can be instance of MfInteger or var containing integer.

seconds

Number of seconds. Can be instance of MfInteger or var containing integer.

Throws MfArgumentOutOfRangeException if the parameters specify a MfTimeSpan value less than MinValue or greater than MaxValue.
Throws MfArgumentException if there is an error get a value from a parameter.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of hours, minutes, and seconds.
The specified hours, minutes, and seconds are converted to ticks, and that value initializes this instance.

Constructor(days, hours, minutes, seconds)

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

Parameters

days

Number of days. Can be instance of MfInteger or var containing integer.

hours

Number of hours. Can be instance of MfInteger or var containing integer.

minutes

Number of Minutes. Can be instance of MfInteger or var containing integer.

seconds

Number of seconds. Can be instance of MfInteger or var containing integer.

Throws MfArgumentOutOfRangeException if the parameters specify a MfTimeSpan value less than MinValue or greater than MaxValue.
Throws MfArgumentException if there is an error get a value from a parameter.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of days, hours, minutes, and seconds.
The specified days, hours, minutes, and seconds are converted to ticks, and that value initializes this instance.

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.

Parameters

days

Number of days. Can be instance of MfInteger or var containing integer.

hours

Number of hours. Can be instance of MfInteger or var containing integer.

minutes

Number of Minutes. Can be instance of MfInteger or var containing integer.

seconds

Number of seconds. Can be instance of MfInteger or var containing integer.

milliseconds

Number of milliseconds. Can be instance of MfInteger or var containing integer.

Throws MfArgumentOutOfRangeException if the parameters specify a MfTimeSpan value less than MinValue or greater than MaxValue.
Throws MfArgumentException if there is an error get a value from a parameter.

Remarks

This constructor initializes the MfTimeSpan
Ticks property will have a value of days, hours, minutes, seconds and milliseconds.
The specified days, hours, minutes, seconds and milliseconds are converted to ticks, and that value initializes this instance.

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