Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFTimeRange Constructor (String, String, IFormatProvider)

AFTimeRange Constructor (String, String, IFormatProvider)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFTimeRange Constructor (String, String, IFormatProvider)
Creates a new AFTimeRange object with the specified string representations of start and end times using the specified culture-specific information and formatting style.

Namespace:  OSIsoft.AF.Time
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFTimeRange(
	string startTime,
	string endTime,
	IFormatProvider provider
)
Public Sub New ( 
	startTime As String,
	endTime As String,
	provider As IFormatProvider
)

Dim startTime As String
Dim endTime As String
Dim provider As IFormatProvider

Dim instance As New AFTimeRange(startTime, 
	endTime, provider)
public:
AFTimeRange(
	String^ startTime, 
	String^ endTime, 
	IFormatProvider^ provider
)
new : 
        startTime : string * 
        endTime : string * 
        provider : IFormatProvider -> AFTimeRange

Parameters

startTime
Type: SystemString

The starting time of the time range represented by this object, specified in a string format. Strings are interpreted as local time unless it also contains a time zone indicator, such as a trailing "Z" or "GMT". PI Time formats ("*", "T", "*-1h", "+3d", etc.) are also supported.

Relative parameter rules:

  • If the startTime starts with "+" or "-" (without a "*" specified), then the start time will be relative to the end time.
  • If the endTime starts with "+" or "-" (without a "*" specified) and the startTime does not start with "+" or "-", then the end time will be relative to the start time.
  • If neither of these conditions are true, then the times are not relative to each other.

endTime
Type: SystemString

The ending time of the time range represented by this object, specified in a string format. Strings are interpreted as local time unless it also contains a time zone indicator, such as a trailing "Z" or "GMT". PI Time formats ("*", "T", "*-1h", "+3d", etc.) are also supported.

Relative parameter rules:

  • If the startTime starts with "+" or "-" (without a "*" specified), then the start time will be relative to the end time.
  • If the endTime starts with "+" or "-" (without a "*" specified) and the startTime does not start with "+" or "-", then the end time will be relative to the start time.
  • If neither of these conditions are true, then the times are not relative to each other.

provider
Type: SystemIFormatProvider

An object that supplies culture-specific formatting information about the time string parameters. The AFTimeZoneFormatProvider can be used to provide the AFTimeZone to be used when parsing. The AFLocaleIndependentFormatProvider can be used when parsing PI SDK locale independent time strings.

If or an AFTimeZoneFormatProvider is specified with the Provider as , then CurrentCulture will be used first when parsing the time strings. If the parsing fails in this case, then a second attempt is made to parse using InvariantCulture.

Remarks

An AFTimeRange represents a period of time between the StartTime and EndTime. This constructor will use the specified provider when parsing the startTime and endTime parameters.

Version Information

AFSDK


See Also

In This Topic
TitleResults for “How to create a CRG?”Also Available in