Skip to main content

CalculateTimeSpan

This Script is part of the Community Common Scripts Pack.#

Supported versions

Supported Cortex XSOAR versions: 6.1.0 and later.

Calculates the time span between two dates using Powershell's New-TimeSpan command.

A timespan with a start date of "2022-04-02T15:42:48" and end date of "2022-04-12T16:55:07" would return the following:

Days : 10 Hours : 1 Minutes : 12 Seconds : 19 Milliseconds : 0 Ticks : 8683390000000 TotalDays : 10.0502199074074 TotalHours : 241.205277777778 TotalMinutes : 14472.3166666667 TotalSeconds : 868339 TotalMilliseconds : 868339000

Script Data#


NameDescription
Script Typepowershell
TagsUtilities

Inputs#


Argument NameDescription
start_timeSpecifies the start of a time span. Enter a string that represents the date and time, such as "3/15/09". If no value supplied the current date time will be used
end_timeSpecifies the end of a time span. If no value supplied the current date and time will be used.

Outputs#


PathDescriptionType
TimeSpan.DaysThe number of whole days between the start and end timeUnknown
TimeSpan.HoursThe number of whole hours between the start and end timeUnknown
TimeSpan.MinutesThe number of whole minutes between the start and end timeUnknown
TimeSpan.SecondsThe number of whole seconds between the start and end timeUnknown
TimeSpan.MillisecondsThe number of whole milliseconds between the start and end timeUnknown
TimeSpan.TicksThe number of whole ticks between the start and end time. 1 tick is equals to 100 nanoseconds or ten-millionth of a secondUnknown
TimeSpan.TotalDaysThe number of whole and fractional days between the start and end timeUnknown
TimeSpan.TotalHoursThe number of whole and fractional hours between the start and end timeUnknown
TimeSpan.TotalMinutesThe number of whole and fractional minutes between the start and end timeUnknown
TimeSpan.TotalSecondsThe number of whole and fractional seconds between the start and end timeUnknown
TimeSpan.TotalMillisecondsThe number of whole and fractional milliseconds between the start and end timeUnknown