AFTime Constructor (Object, AFTime, IFormatProvider)
- Last UpdatedNov 18, 2025
- 3 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 specified culture-specific 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, IFormatProvider provider )
Public Sub New ( time As Object, defaultTime As AFTime, provider As IFormatProvider ) Dim time As Object Dim defaultTime As AFTime Dim provider As IFormatProvider Dim instance As New AFTime(time, defaultTime, provider)
public: AFTime( Object^ time, AFTime defaultTime, IFormatProvider^ provider )
new : time : Object * defaultTime : AFTime * provider : IFormatProvider -> 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. - 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
This constructor will convert the specified object to a new instance of an
AFTime. This constructor will accept a PISDK.PITime as input.