ICultureInfo.ParseDateTime

Fore Syntax

ParseDateTime(Value: String): DateTime;

Fore.NET Syntax

ParseDateTime(Value: String): DateTime;

Parameters

Value. The value, from which date and time must be obtained.

Description

The ParseDateTime method transforms the specified string value and gets date and time from it.

Comments

Conversion is executed according to the parameters that are set for date and time in operating system's regional standards. If conversion is available, the method returns the obtained date and time in the DateTime format, otherwise exception is thrown.

Due to specific features of system function implementation that determine ParseDateTime, values containing milliseconds cannot be converted. Also, if 12-hour time format is used: contains AM (before afternoon), or PM (afternoon), and the value itself corresponds to the 24-hour format time (greater than 12), conversion will be correct, and exception will not be thrown. The obtained time will correspond to the afternoon time. Example: the 13.25 AM value will be correctly converted into the date with the time 30.12.1899 13:25:00.

Fore Example

Sub UserProc;
Var
    CI: ICultureInfo;
    d: DateTime;
Begin
    CI := CultureInfo.Current;
    d := CI.ParseDateTime(
"14 June 2005 00:10:11");
End Sub UserProc;

After executing the example the "d" variable will contain the date and time "14.06.2005 00:10:11" for Russian regional settings.

Fore.NET Example

The requirements and result of the Fore.NET example executing match with those in the Fore example. Add a link to the ForeSystem system assembly.

Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params: StartParams);
Var
    CI: ICultureInfo;
    cc: CultureInfoClassClass;
    d: DateTime;
Begin
    cc := New CultureInfoClassClass.create();
    CI := cc.Current;
    d := CI.ParseDateTime("14 June 2005 00:10:11");
End Sub;

See also:

ICultureInfo