Description |
Parses the Value string representation of date and/or time into a DateTime value.
Omitting the date component defaults the date to the current date.
The optional FormatProvider parameter determines the parsing rules and is beyond the scope of this article.
The optional Style parameter determines the allowed characters, such as blanks, in the Value.
|
| Notes | Static methods are not methods of an object - they are simply class functions or procedures available at any time.
|
| References | DateTimeStyles
|
|
Microsoft MSDN Links |
System
System.DateTime
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
var
when : DateTime;
begin
Console.WriteLine('This example uses UK datetime formatting');
Console.WriteLine;
when := System.DateTime.Parse('24/06/2004');
Console.WriteLine('Parsed value = {0:F}', when);
when := System.DateTime.Parse('17:30:00');
Console.WriteLine;
Console.WriteLine('Omitted date defaults to the current date');
Console.WriteLine;
Console.WriteLine('Parsed value = {0:F}', when);
when := System.DateTime.Parse('24 June 2004 11:22:33');
Console.WriteLine('Parsed value = {0:F}', when);
Console.ReadLine;
end.
| Show full unit code | This example uses UK datetime formatting
Parsed value = 24 June 2004 00:00:00
Omitted date defaults to the current date
Parsed value = 13 October 2004 17:30:00
Parsed value = 24 June 2004 11:22:33
|
|
|
|