AFTime.ConvertString Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Converts an AFTime or AFTimeSpan input string to a different culture-specific
normalized string.
Namespace: OSIsoft.AF.Time
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static string ConvertString( string input, IFormatProvider fromProvider, IFormatProvider toProvider, bool toAbbreviatedNames = true )
Public Shared Function ConvertString ( input As String, fromProvider As IFormatProvider, toProvider As IFormatProvider, Optional toAbbreviatedNames As Boolean = true ) As String Dim input As String Dim fromProvider As IFormatProvider Dim toProvider As IFormatProvider Dim toAbbreviatedNames As Boolean Dim returnValue As String returnValue = AFTime.ConvertString(input, fromProvider, toProvider, toAbbreviatedNames)
public: static String^ ConvertString( String^ input, IFormatProvider^ fromProvider, IFormatProvider^ toProvider, bool toAbbreviatedNames = true )
static member ConvertString : input : string * fromProvider : IFormatProvider * toProvider : IFormatProvider * ?toAbbreviatedNames : bool (* Defaults: let _toAbbreviatedNames = defaultArg toAbbreviatedNames true *) -> string
Parameters
- input
- Type: SystemString
A string containing the date, time, and interval to convert. - fromProvider
- Type: SystemIFormatProvider
An object that specifies culture-specific formatting information of the input string to be converted. If , then CurrentCulture will be used. If a from provider is not specified or the AFTimeZoneFormatProvider.Provider is and current culture parsing fails, then parsing using InvariantCulture is also attempted. - toProvider
- Type: SystemIFormatProvider
An object that supplies the desired culture-specific formatting information of the converted string. If , then CurrentCulture will be used. - toAbbreviatedNames (Optional)
- Type: SystemBoolean
If , then the converted string will normalized using abbreviated time names. If , then the converted string will normalized using normal (long) time names. The default value of this parameter is .
Return Value
Type: StringReturns the input string that has been converted from the fromProvider culture to the toProvider culture.
Remarks
This method converts an AFTime or AFTimeSpan input string specified in the
fromProvider culture to a different culture-specific normalized string specified by the
toProvider. The converted string will be normalized using the abbreviated time names or
normal time names depending upon the toAbbreviatedNames parameter.
See the documentation for
TryParse(String, AFTime, IFormatProvider, AFTime) for more information.