This is a migrated thread and some comments may be shown as answers.

Date format incorrect on Grid

4 Answers 289 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 2
Rodney asked on 03 Nov 2016, 05:48 PM

I'm having an issue with date formats on the grid. I've read through lot's of related threads, but they don't seem to be correcting my situation. The date is display as: 11/03/2016T00:00:00

The page has the column defined as:

<telerik:GridDateTimeColumn UniqueName="RECORDSTARTDATE" HeaderText="Record Start Date" DataField="RECORDSTARTDATE" ShowFilterIcon="false"
    DataFormatString="{0:dd MMM yyyy}" DataType="System.DateTime" HtmlEncode="false" ItemStyle-CssClass="center"
    CurrentFilterFunction="GreaterThanOrEqualTo" HeaderStyle-Width="120px" />

 

The DataFormatString is defined as ="{0:dd MMM yyyy}" so my dates not coming out even close.

Any help would be appreciated.

 

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 08 Nov 2016, 04:03 PM
Hi Rodney,

Generally, the mentioned property should work as expected. Please make sure that the values coming from your database are of type DateTime.

I am also sending a sample RadGrid web site to demonstrate that.

Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
0
Rodney
Top achievements
Rank 2
answered on 08 Nov 2016, 08:47 PM
Actually, the value coming is is just a date using CONVER(date, RECORDSTARTDATE) will this cause the problem I'm seeing? I didn't see just a date datatype for the DataType parameter.
0
Rodney
Top achievements
Rank 2
answered on 08 Nov 2016, 08:55 PM
Also I didn't see the link to the example. Did I miss it?
0
Eyup
Telerik team
answered on 11 Nov 2016, 04:27 PM
Hello Rodney,

Sorry, I've missed to attach the sample. I am re-attaching it to this post.
Basically, the grid uses default formatting logic, therefore, the values should be DateTime objects:
https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx

Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Rodney
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Rodney
Top achievements
Rank 2
Share this question
or