<div class="meta" robots="noindex">

</div>

Method

# ParseDate

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `DateTime.FromString<datetime.fromstring>` as a replacement.

</div>

## Description

Parses a date passed as a `string</api/data_types/string>` and creates a `DateTime</api/data_types/datetime>` object.

## Usage

*result*=**ParseDate**(*Text*, `ByRef</api/language/byref>` *ParsedDate*)

| Part       | Type                                 | Description                                                                                                       |
|------------|--------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| result     | `Boolean</api/data_types/boolean>`   | Returns `True</api/language/true>` if *Text* was successfully parsed.                                             |
| Text       | `String</api/data_types/string>`     | The `DateTime</api/data_types/datetime>` string to be converted to a `DateTime</api/data_types/datetime>` object. |
| ParsedDate | `DateTime</api/data_types/datetime>` | After a successful call, it contains the parsed date as a `DateTime</api/data_types/datetime>` object.            |

## Notes

<div class="note">

<div class="title">

Note

</div>

On Windows (due to the Windows API being used), it is not possible to go back further than 1 January 1601.

</div>

The *Text* parameter must be a valid `string</api/data_types/string>` representation of a `DateTime</api/data_types/datetime>`. <span class="title-ref">ParseDate</span> uses the current date formats that are specified in the regional/international system settings on the user's computer. It recognizes those formats. For that reason, the specific formats that <span class="title-ref">ParseDate</span> will support on a particular computer cannot be specified. If you are having problems with a date format, check the International formats (macOS), Regional Settings (Windows), or equivalent feature on Linux to be sure that the format you are using is specified.

For example, if you want to use the dot as the separator in short dates (e.g.,1.6.2005 as January 6, 2005) you need to change the separator to the dot in International/Regional settings. When you do so, the string "1.6.2005" will work. However, "1/6/2005" (or some other separator) will not. Similarly, if you want to use "6Jan2005" then you need to change the "Medium" format in International formats.

You also need to be aware of the order in with the month, day, and year appear in the format specification, as the defaults change by region. For example, the string "12/11/2004" is parsed as the eleventh of December in the US (using the default format and separator, "/"). If the computer is configured for the default British date format, it will be parsed as the twelfth of November.

ParseDate will parse dates based on the user's locale even if the user's locale is a Unicode-only locale.

If the passed date string uses two digits for the year, <span class="title-ref">ParseDate</span> on macOS assumes the current century.

ParseDate does not parse the Time value of a `DateTime</api/data_types/datetime>`, if present.

## Sample code

The following code attempts to convert a string value to a Date. If it succeeds, the date is displayed:

``` xojo
Dim theDate As New Date
Dim converted As Boolean

' Attempt to convert the string "12/31/2013" to a date. If
' the conversion succeeds, theDate variable contains the converted date.
converted = ParseDate("12/31/2013", theDate)
If converted Then
  MsgBox("Converted to: " + theDate.AbbreviatedDate)
Else
  MsgBox("Could not convert the string to a date.")
End If
```

## Compatibility

All project types on all supported operating systems.

## See also

`DateTime</api/data_types/datetime>` class, `Database</api/databases/database>` class examples.
