---
url: /flow/guide/scripting-reference/functions/datetime/stringtodatetime.md
---

# StringToDateTime

## Declaration

`Function StringtoDateTime( const DateTimeFormat : string; const DateTimeStr : string) : TDateTime`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
var MyStrDate : string
begin
MyStrDate := '23/02/2006';
Value := StringToDateTime('dd/mm/yyyy',MyStrDate);
//Value will be equal to a TDateTime of 23 Feb 2006
end;
```

## Description

StringToDateTime will return a TDateTime value built from the DateTimeStr value. DateTimeFormat describes the format of DateTimeStr - refer to [Date Format Specifiers](/flow/guide/scripting-reference/format-specifiers/date-format-specifiers) for help creating DateTimeFormat parameter.
