We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to set the custom date time format in GridDataControl

In GridDataControl, you can load DateTimeEdit CellType by defining GridDataDateTimeVisibleColumn or by setting CellType property of GridDataVisibleColumn.ColumnStyle to DateTimeEdit.
When you load DateTimeEdit Celltype, you can customize the format using DateTimePattern property of ColumnStyle.

The various formats available in DateTimePattern are as follows.

DateTimePattern name

Format

Example

FullDateTime

Day, M d, yyyy HH:mm:ss

Monday, May 25, 2009 11:00:00 AM

LongDate

Day M/d/yyyy

Monday may 25 2009

LongTime

HH:mm:ss AM/PM

11:00:00 AM

MonthDay

M d

may 25

RFC1123

Day , d M yyyy HH:mm:ss GMT

mon,25 may 2009 11:00:00 GMT

ShortDate

M/d/yyyy

5/25/2009

ShortTime

HH:ss AM/PM

11:00 AM

SortableDateTime

yyyy-M-dT HH:mm:ss

2009-05-25T11:00:00

UniversalSortableDateTime

yyyy-M-d HH:mm:ssZ

2009-05-25 11:00:00Z

YearMonth

M yyyy

May 2009

 

Where M= month, d=date, yyyy= year in four digits, HH= hour, mm=minutes, ss=seconds, Z= universal time designator.

In case, the default patterns do not meet your requirements, you can customize the date and time format by setting DateTimePattern Property as CustomPattern and define your own format for CustomPattern in the GridDataDateTimeEditInfo.

An example for custom format is displayed in the following code sample.

XAML

 

Here the CustomPattern format is defined as “M/d/yyyy HH:mm:ss”. The following screenshot displays the output for the above code in the “GridDataControl”.

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
2366 07/08/2014 07/10/2014 WPF GridDataControl 4 12.1.0.43
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.