# Javascript: DateFormField.setDate Method

> Sets the DateFormField's date.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: DateFormField.setDate Method
- **350 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/setdate-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/setdate-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/setdate-method/llms-full.txt

---

### Description

Sets the DateFormField's date.

### Syntax

```javascript
<void> DateFormField.setDate(<Number> unixTime, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| unixTime | The date in Unix Time. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `DateFormField.setDate` in a practical document-editing workflow. It sets the DateFormField's date.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function configureDate(dateFormField) {
    dateFormField.setDate(
        1767225600,
        function() {
            console.log("set date completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: DateFormField.getSupportedDateFormats Method](https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/getsupporteddateformats-method/llms-full.txt)
- **Next:** [Javascript: DateFormField.setDateFormat Method](https://docs.textcontrol.com/ds-server/reference/javascript/dateformfield/setdateformat-method/llms-full.txt)
