# Date Column

The `DataGridDateColumn` represents `DateTimeOffset` objects.

## Example

The following example shows how to generate a `DataGridDateColumn` manually.

1. First, create the business object.

#### **Create the Data Model**

```C#
public class Data
{
	public string Event { get; set; }
	public DateTimeOffset Date { get; set; }
}
```

1. The next step is to create some sample data.

#### **Create Sample Data**

```C#
public MainPage()
{
	this.InitializeComponent();
	this.DataContext = new List<Data>()
	{
		new Data { Event = "Meeting", Date = new DateTimeOffset(2013, 3, 12, 14, 00, 0,new TimeSpan())},
		new Data { Event = "Lecture", Date = new DateTimeOffset(2013, 3, 12, 14, 30, 0,new TimeSpan())},
		new Data { Event = "Meeting", Date = new DateTimeOffset(2013, 3, 12, 15, 15, 0,new TimeSpan())},
		new Data { Event = "Conference", Date = new DateTimeOffset(2013, 3, 12, 16, 00, 0,new TimeSpan())}
	};
}
```

1. To associate each column with the relevant property from the model, the example also uses the `PropertyName` property.

#### **Define the DataGrid in XAML**

```XAML
<telerikGrid:RadDataGrid UserEditMode="Inline" ItemsSource="{Binding}" AutoGenerateColumns="False">
	<telerikGrid:RadDataGrid.Columns>
		<telerikGrid:DataGridTextColumn PropertyName="Event" Header="Event"/>
		<telerikGrid:DataGridDateColumn PropertyName="Date" Header="Date"/>
	</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
```

**Date Column**

![WinUI Date Column](https://www.telerik.com/winui/documentation/assets/bc28af6f7af26e9dc4608c2c583272d2/datagrid_datecolumn.png)

## Format

You can use the `CellContentFormat` property to format the `Date` and utilize any of the [.NET Standard Date and Time Format Strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings).

#### **Define the Format in XAML**

```XAML
<telerikGrid:RadDataGrid UserEditMode="Inline" ItemsSource="{Binding}" AutoGenerateColumns="False">
	<telerikGrid:RadDataGrid.Columns>
		<telerikGrid:DataGridTextColumn PropertyName="Event" Header="Event"/>
		<telerikGrid:DataGridDateColumn PropertyName="Date" Header="Date" CellContentFormat="{}{0:M}" />
	</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
```

**Date Column Format**

![WinUI Date Column](https://www.telerik.com/winui/documentation/assets/6226a6477f118506e7bff5bcc8e5b472/datagrid_datecolumn_format.png)
