---
url: /flow/guide/scripting-reference/classes/field/field.asdatetime.md
---

# Field.AsDateTime

## Declaration

`property AsDateTime: string;`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := Dataset['myfield'].AsDateTime; //the value of myfield is returned as a Date Time
end;
```

## Description

Returns the value of the Field object as a [Datetime (TDateTime)](/flow/guide/scripting-reference/data-types/datetime). If the field is null then the default date of 12/30/1899 12:00 am.

It is recommended that you use this property when referencing Datetime type fields. This will help you avoid issues with null values causing [Datetime](/flow/guide/scripting-reference/functions/datetime/) and [Formatting](/flow/guide/scripting-reference/functions/formatting/) functions to fail.
