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

display bound value of date field formatted as short date

1 Answer 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 2
Rick asked on 07 Dec 2015, 10:14 PM

A search did not show up anything on my problem. I have a database date field I want to display on a form. I don't want to use an input datepicker. I just want to display a readonly short datetime. Things like the created and modified dates for a record.

I feel silly not finding this right away.

I hope somebody has done this before and it is easy.

Thanks,

Rick

1 Answer, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 2
answered on 08 Dec 2015, 04:49 PM

Figured out one way: text binding with a forced calculation of the dependent field in the soon to be bound viewModel.

<span class="k-textbox" data-bind="text: cr.CreatedShortDate"></span>
 
with
 
viewModel.cr.CreatedShortDate = kendo.toString(viewModel.cr.Created, "g"); 

If I can get this calculation to occur automatically it would be great.

Rick

Tags
General Discussions
Asked by
Rick
Top achievements
Rank 2
Answers by
Rick
Top achievements
Rank 2
Share this question
or