AFTime Constructor (Object, AFTime)
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Initializes a new instance of the AFTime structure to the specified value
representation of time using the CurrentCulture
information and formatting style, providing a default if necessary.
Namespace: OSIsoft.AF.Time
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public AFTime( Object time, AFTime defaultTime )
Public Sub New ( time As Object, defaultTime As AFTime ) Dim time As Object Dim defaultTime As AFTime Dim instance As New AFTime(time, defaultTime)
public: AFTime( Object^ time, AFTime defaultTime )
new : time : Object * defaultTime : AFTime -> AFTime
Parameters
- time
- Type: SystemObject
Converts different types of objects, including PISDK.PITime objects, to AFTime. A will return an AFTime representing the current time. - defaultTime
- Type: OSIsoft.AF.TimeAFTime
This parameter serves as the reference time to be used when the time parameter contain a relative string reference (e.g. "*", "Today", etc.) instead of using the current time. The server time can be used as a reference time by specifying PISystem.ServerTime, PIServer.ServerTime, or AFAttribute.ServerTime for this parameter. If the time parameter cannot be converted to a valid time, then the value of the new AFTime instance will be set to the time specified for this parameter.
Remarks
This constructor will convert the specified object to a new instance of an
AFTime. This constructor will accept a PISDK.PITime as input.