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

Date column not formatting right.

6 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brady
Top achievements
Rank 1
Brady asked on 17 Apr 2012, 10:04 AM
I have a date column in my grid defined as below:

LastLoginTime: { editable: false, type: "date" } // in the data source model
{ field: "LastLoginTime", title: "Last Login", filterable: false, format: "{0:dd/MMMM/yyyy}" } // in the columns collection of the grid


The date in the column displaysThe date in the column always displays as '/Date(1334652996959)/', the json value that comes back from the server. What's up here?

6 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 17 Apr 2012, 03:56 PM
Hello Brady,

Could you verify that you have correctly declared a schema and date type for the field in question. This way the DataSource will try to convert the field value to JavaScript  Date object. You may refer to this online demo which uses the DataSource scheme option.

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
James
Top achievements
Rank 1
answered on 18 Apr 2012, 12:45 AM
I have the same issue. I'm already using the same example above. Any ideas? Code is exactly the same as the sample i my vs2010 web page with 1 exception. I'm referring to jquery this way: 
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
0
Rosen
Telerik team
answered on 18 Apr 2012, 10:04 AM
Hi James,

You should make sure that you are using Q1 2012 or later release of KendoUI.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
James
Top achievements
Rank 1
answered on 18 Apr 2012, 05:13 PM
Hey Thanks Rosen. That did the trick. I had not downloaded the new version. Keep those new versions coming!!
0
Ruben
Top achievements
Rank 1
answered on 09 Dec 2016, 07:26 PM
How I wold know if my field on the datasource properly setted to the type I want(date) because I set it as Brady and it still didn't work
0
Rosen
Telerik team
answered on 12 Dec 2016, 08:41 AM

Hello Ruben,

I'm not sure I understood your question. If you have set the type via the field declaration it should be set. However, the automatic parsing of the string value, if such is used, does not support all of the possible custom date formats. If the date is not parsed and is still shown as a string, then maybe you need to set a custom parse function via the field declaration in which to convert the input string to a Date instance.

If you continue to experience difficulties please open a separate support request in which to provide as much information about the issue and your setup as possible. A small runnable sample will be appreciated.

Regards,
Rosen
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
Brady
Top achievements
Rank 1
Answers by
Rosen
Telerik team
James
Top achievements
Rank 1
Ruben
Top achievements
Rank 1
Share this question
or