Removing leading zeros with MonthView-DayHeaderDateFormat formatting

4 posts, 0 answers
  1. Greg Mercer
    Greg Mercer avatar
    13 posts
    Member since:
    Jan 2010

    Posted 24 Feb 2010 Link to this post

    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
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Mar 2010 Link to this post

    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.
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Mar 2010 Link to this post

    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.
  4. Neil
    Neil avatar
    8 posts
    Member since:
    Oct 2011

    Posted 10 Nov 2011 Link to this post

    Unfortunately the "'d'" doesn't work.

    Using "%d" does, though.
Back to Top