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)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFTimeRange Constructor (String, String)
Creates a new AFTimeRange object with the specified string representations of start and end times.

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

Syntax

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

Dim startTime As String
Dim endTime As String

Dim instance As New AFTimeRange(startTime, 
	endTime)
public:
AFTimeRange(
	String^ startTime, 
	String^ endTime
)
new : 
        startTime : string * 
        endTime : string -> 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.

Remarks

An AFTimeRange represents a period of time between the StartTime and EndTime. This constructor will use the CurrentCulture when parsing the startTime and endTime parameters. Use the constructor that accepts an IFormatProvider to specify a specific culture or for parsing.

Version Information

AFSDK


See Also

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