< Back

Get-NRTimeSpan

Sat Jan 18, 2020 5:05 pm

NAME Get-NRTimeSpan



SYNOPSIS

Builds a timespan string for NewRelic API calls





SYNTAX

Get-NRTimeSpan [-Start] <DateTime> [-End] <DateTime> [-UseLocalTime] [<CommonParameters>]





DESCRIPTION

Builds a timespan string for NewRelic API calls





PARAMETERS

-Start <DateTime>

The datetime of when to start the timespan



Required? true

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-End <DateTime>

The datetime of when to end the timespan



Required? true

Position? 2

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-UseLocalTime [<SwitchParameter>]

Use local time



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

A start and end Datetime object





OUTPUTS

Timespan string usable in NewRelic API





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$Start = (Get-Date).AddDays(-1)



$End = Get-Date



Get-NRTimeSpan -Start $Start -End $End



from=2017-05-27T20:19:02+00:00&to=2017-05-28T20:19:02+00:00



Returns a timespan string from yesterday to the current date











RELATED LINKS