Get Part of Time Span

Verb: getTimePart

Gets a part of a time span or the time span converted to the option selected in the Part parameter.

Syntax

getTimePart --time(TimeSpan) --type(TimePart) [--gettotals(Boolean)] (Numeric)=value

Inputs

Script Designer Required AcceptedTypes Description
--time Time Required Time Span Time span from which a part is obtained. Valid time formats are:
  • hh:mm:ss
  • hh:mm:ss.fff
  • hh:mm:ss:fffffff
  • d.hh:mm:ss
  • d.hh:mm:ss.fff
  • d.hh:mm:ss.fffffff
  • --type Part Required TimePart Option to select a time unit that represents the part that should be obtained from the time range:
  • Day
  • Hours
  • Milliseconds
  • Minutes
  • Seconds
  • --gettotals Get totals Optional Boolean When enabled, gets the total time span, converted according to the option selected in the Part parameter.

    Outputs

    Script Designer AcceptedTypes Description
    value Obtained value Number Part of the time span that was obtained.

    Example

    Example 1: The Get Part of Time Span command gets the total hours of the variable "getTimeSpan", returning 26 hours.

    defVar --name timePart --type Numeric
    defVar --name getTimeSpan --type TimeSpan --value "1.02:00:00"
    // Get the total time of the entered variable "timeSpan".
    getTimePart --time ${getTimeSpan} --type "Hours" --gettotals  timePart=value
    logMessage --message "${timePart}" --type "Info"
    // The example returns the following output:
    // 26
    

    Example 2: The Get Part of Time Span, command gets the day part of the entered time variable, returning 1 day.

    defVar --name timePart --type Numeric
    defVar --name getTimePart --type TimeSpan --value "1.02:00:00"
    // Get the day part of the entered variable "getTimePart".
    getTimePart --time ${getTimePart} --type "Days" timePart=value
    logMessage --message "${timePart}" --type "Info"
    // The example returns the following output:
    // 1