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

Removing leading zeros with MonthView-DayHeaderDateFormat formatting

3 Answers 191 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Greg Mercer
Top achievements
Rank 1
Greg Mercer asked on 24 Feb 2010, 09:28 PM
Hi,

I'm trying to set the header date formatting for the MonthView to not have a leading zero.

When I make the format change for the "first day" like this MonthView-FirstDayHeaderDateFormat="MMM d", the values are formatted correctly as Feb 1.

However, when I make the following format change for the remaining day headers: MonthView-DayHeaderDateFormat="d", it doesn't format the values as I would have expected (eg. 2). It instead formats the day headers as 02/02/2010.

Is there something I'm doing wrong?

Thanks,
Greg

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 Mar 2010, 08:50 AM
Hi Greg,

I was able to replicate the problem. I will forward it to our development to team for review. Meanwhile, if you do not set the MonthView-DayHeaderDateFormat property, but leave it by default, you should get the desired result (e.g. 2, 3, 4... etc). You can also try setting MonthView-DayHeaderDateFormat="dd". I tested with this value and it seemed to have applied correctly.


Greetings,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Peter
Telerik team
answered on 02 Mar 2010, 09:04 AM
Hello Greg,

Further investigation on this case showed that everything is working as expected. Please, refer to this msdn topic: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx. The section on 'The "d" Custom Format Specifier' explains what caused the problem when setting DayHeaderDateFormat="d" -

'The "d" custom format specifier represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero.

If the "d" format specifier is used without other custom format specifiers, it is interpreted as the "d" standard date and time format specifier ...'

A possible workaround is to set:

MonthView-DayHeaderDateFormat="''d" (note the single quotes preceding the 'd');


Cheers,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Neil
Top achievements
Rank 1
answered on 10 Nov 2011, 06:48 PM
Unfortunately the "'d'" doesn't work.

Using "%d" does, though.
Tags
Scheduler
Asked by
Greg Mercer
Top achievements
Rank 1
Answers by
Peter
Telerik team
Neil
Top achievements
Rank 1
Share this question
or