# DateFormField.DateFormat Property

> Gets or sets the date's format. For a certain DateFormField the format string should be one of the strings returned through the SupportedDateFormats property. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date. When this property is an empty string, which is the default value, a default format is used depending on the culture set for the date field's text.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > DateFormField.DateFormat Property
- **651 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/dateformat-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/dateformat-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/dateformat-property/llms-full.txt

---

### Description

Gets or sets the date's format. For a certain DateFormField the format string should be one of the strings returned through the [SupportedDateFormats](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/supporteddateformats-property/llms-full.txt) property. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date. When this property is an empty string, which is the default value, a default format is used depending on the culture set for the date field's text.

### Syntax

```csharp
public string DateFormat { get; set; }
```

```vbnet
Public Property DateFormat As String
```

### Examples

The following example adds a prefilled delivery-date field to a form by using `DateFormField.DateFormat`.

```csharp
DateFormField dateFormField = new(DateTime.Today.AddDays(14), 0) { Name = "DeliveryDate" };
textControl.FormFields.Add(dateFormField);

dateFormField.DateFormat = "0.00";
if (!string.IsNullOrWhiteSpace(dateFormField.DateFormat))
{
    Console.WriteLine($"Date Format: {dateFormField.DateFormat}");
}
```

```vbnet
Dim dateFormField As New DateFormField(Date.Today.AddDays(14), 0) With { .Name = "DeliveryDate" }
textControl.FormFields.Add(dateFormField)

dateFormField.DateFormat = "0.00"
If Not String.IsNullOrWhiteSpace(dateFormField.DateFormat) Then
    Console.WriteLine($"Date Format: {dateFormField.DateFormat}")
End If
```

---

## Nearby

- **Previous:** [DateFormField.Date Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/date-property/llms-full.txt)
- **Next:** [DateFormField.EmptyWidth Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/dateformfield/emptywidth-property/llms-full.txt)
