AFTime Implicit Conversion (DateTime to AFTime)
- Last UpdatedJan 12, 2026
- 2 minute read
- PI System
- AF SDK 3.2.0
- Developer
Implicit cast operator to convert a DateTime to an AFTime.
Namespace: OSIsoft.AF.Time
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
public static implicit operator AFTime ( DateTime time )
Public Shared Widening Operator CType ( time As DateTime ) As AFTime Dim input As DateTime Dim output As AFTime output = CType(input, AFTime)
static implicit operator AFTime ( DateTime time )
Parameters
- time
- Type: SystemDateTime
The DateTime to be converted.
Return Value
Type: AFTimeReturns a new AFTime created from the specified time parameter.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if the timestamp is between 1/1/1900 and 1/1/1970. |
Remarks
Values less than January 1, 1900 will automatically be converted to MinValue.
Values between January 1, 1900 and MinValue (January 1, 1970) will generate an
ArgumentOutOfRangeException.