# ParseDate (Formats, Str)

| **Name**    | ***ParseDate***                                                                                                                                                                                                                    |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | ParseDate (Unknown formats, String str)                                                                                                                                                                                            |
| Purpose     | To parse a date based on a specified format.                                                                                                                                                                                       |
| Description | Returns a date time value if the value was successfully parsed. Otherwise returns an error. This function successively applies specified formats and returns date time value if date is parsed using any of the specified formats. |
| Return Type | DateTime                                                                                                                                                                                                                           |
| Parameters  | <p>formats \[Astera.Functions.DateFormats]</p><p>str \[System.String] – String to be converted</p>                                                                                                                                 |

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FbBo3m4SaBHFPjWPyctws%2F0.png?alt=media)

**Example**

We have an *Orders* dataset with a *ShippedDate* field.

<figure><img src="https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F9TUkmNmGIxXaZlHJS0h4%2F1.png?alt=media" alt=""><figcaption></figcaption></figure>

In this example, we will map this field to the string input of the function transformation object. We will also pass a specific date time format, to match the date format of the *ShippedDate* field, to the *Format1* field in the function transformation object using a *Variables* object.

Where,

*Format1* = dd/MM/yyyy hh:mm:ss tt

<figure><img src="https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FzCYp9hmLrrLSWhmLtYue%2F2.png?alt=media" alt=""><figcaption></figcaption></figure>

In the output window, you can see values from the *ShippedDate* field have been successfully parsed by the function transformation object, as the provided date time format has been matched.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FfXMEWZxTATL48hnDUXPL%2F3.png?alt=media)
