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

[Solved] Formatting Cells

2 Answers 105 Views
Grid for HTML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 09 Apr 2013, 04:33 AM
In the documentation at http://www.telerik.com/help/windows-8-html/grid-columns-configuration.html it shows a 'format' property for columns and an example of '{0:N2}'. Where can I find the available formats?

In my case I want to format a date value.


2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 09 Apr 2013, 08:24 AM
Hi Chris,

The API for formatting dates and numbers in RadGrid is still subject to changes. Below I will list the current formatting options for dates, but for Q2 they might be changed (as you know RadGrid is currently in CTP stage and changes to its API are possible).

The format string looks like this:

"{0:X}"

where X can be:

d - short date pattern, e.g. 11/6/2000
D - long date pattern, e.g. Monday, November 06, 2000
F - full date/time pattern, e.g. Monday, November 06, 2000 12:00:00 AM
g - general date/time pattern (short time), e.g. 11/6/2000 12:00 AM
G - general date/time pattern (long time), e.g. 11/6/2000 12:00:00 AM
m|M - month/day pattern, e.g. November 06
u - universal sortable date/time pattern, e.g. 2000-11-06 00:00:00Z
y|Y - month/year pattern, e.g. November, 2000

Custom date formats can be created by using one or more custom date specifiers:
d - the day of the month, from 1 to 31
dd - the zero-padded day of the month - from 01 to 31
ddd - the abbreviated name of the day of the week
dddd - the full name of the day of the week
f - the tenths of a second
ff - the hundreds of a second
fff - the milliseconds
M - the month, from 1 to 12
MM - the zero-padded month, from 01 to 12
MMM - the abbreviated name of the month
MMMM - the full name of the month
h - the hour, using 12-hour clock - from 1 to 12
hh - the zero-padded hour, using 12-hour clock - from 01 to 12
H - the hour, using 24-hour clock - from 0 to 23
HH - the zero-padded hour, using 24-hour clock - from 00 to 23
m - the minute, from 0 to 59
mm - the zero-padded minute, from 00 to 59
s - the second, from 00 to 59
ss - the zero-padded second, from 00 to 59
tt - the AM/PM designator



All the best,
Tsvetina
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Chris
Top achievements
Rank 1
answered on 09 Apr 2013, 08:28 AM
Thanks, I notice they are quite similar to the .NET format strings which I assume is intentional.
Tags
Grid for HTML
Asked by
Chris
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Chris
Top achievements
Rank 1
Share this question
or