Time Span Functions in Expressions

Time span values represent an interval of time. Time span functions perform operations on these values.

The following information describes the functions available for building expressions.

Tip:
  • Any information within square brackets [ ] is optional.

TimeOfDay

Description
Gets the time components of a DateTime value. Only the time part of the date is associated with the time zone.
Format
TimeOfDay(date)
ParametersRequired?Data TypeDescription
dateYesDateTimeDate/time to isolate the time from.

Time

Description
Creates a time value based on time components. The return value is a time span value.
Format
Time(days, hours, minutes, seconds, milliseconds)
ParametersRequired?Data TypeDescription
daysYesNumericNumber of days to include in the time value.
hoursYesNumericNumber of hours to include in the time value.
minutesYesNumericNumber of minutes to include in the time value.
secondsYesNumericNumber of seconds to include in the time value.
millisecondsYesNumericNumber of milliseconds to include in the time value.

FromDays

Description
Creates a TimeSpan value by specifying the number of days in a time span.
Format
FromDays(days)
ParametersRequired?Data TypeDescription
daysYesNumericNumber of days.

FromHours

Description
Creates a TimeSpan value by specifying the number of hours in a time span.
Format
FromHours(hours)
ParametersRequired?Data TypeDescription
hoursYesNumericNumber of hours.

FromMinutes

Description
Creates a TimeSpan value by specifying the number of minutes in a time span.
Format
FromMinutes(minutes)
ParametersRequired?Data TypeDescription
minutesYesNumericNumber of minutes.

FromSeconds

Description
Creates a TimeSpan value by specifying the number of seconds in a time span.
Format
FromSeconds(seconds)
ParametersRequired?Data TypeDescription
secondsYesNumericNumber of seconds.

FromMilliseconds

Description
Creates a TimeSpan value by specifying the number of milliseconds in a time span.
Format
FromMilliseconds(milliseconds)
ParametersRequired?Data TypeDescription
millisecondsYesNumericNumber of milliseconds.

Days

Description
Returns the days component of a time span value.
Format
Days(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime to extract the component from.

Hours

Description
Returns the hours component of a time span value.
Format
Hours(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime to extract the component from.

Minutes

Description
Returns the minutes component of a time span value.
Format
Minutes(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime to extract the component from.

Seconds

Description
Returns the seconds component of a time span value.
Format
Seconds(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime to extract the component from.

Milliseconds

Description
Returns the milliseconds component of a time span value.
Format
Milliseconds(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime to extract the component from.

TotalDays

Description
Converts a TimeSpan value to a number of days. The return type is a double.
Format
TotalDays(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTotal time span value expressed as a number of days.

TotalHours

Description
Converts a TimeSpan value to a number of hours. The return type is a double.
Format
TotalHours(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTotal time span value expressed as a number of hours.

TotalMinutes

Description
Converts a TimeSpan value to a number of minutes. The return type is a double.
Format
TotalMinutes(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTotal time span value expressed as a number of minutes.

TotalSeconds

Description
Converts a TimeSpan value to a number of seconds. The return type is a double.
Format
TotalSeconds(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTotal time span value expressed as a number of seconds.

TotalMilliseconds

Description
Converts a TimeSpan value to a number of milliseconds. The return type is a double.
Format
TotalMilliseconds(timespan)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTotal time span value expressed as a number of milliseconds.

Duration

Description
Returns the absolute value of a time span.
Format
Duration(timespan)
Example
Time(0,-5,0,0,0) represents -5 hours. Using Duration, you get a time span that represents +5 hours:
  • Duration(Time(0,-5,0,0,0)) = Time(0,5,0,0,0)
  • Duration(FromHours(-5)) = FromHours(5)
ParametersRequired?Data TypeDescription
timespanYesTimeSpanTime span value to get the absolute value of.