RadDateInput MM/YYYY format

5 posts, 0 answers
  1. prashanth_t
    prashanth_t avatar
    10 posts
    Member since:
    Apr 2009

    Posted 22 May 2009 Link to this post

    I'm using a RadDateInput control. The Culture is set to English(United States) and Dateformat, DisplayDate format are set to MM/yyyy.
    When I run the application if I enter a value like 03/2010 on leaving the control the value is set to 05/2010 (the month part is being replaced by the current month). How can I fix this problem?

    I don't need a date value; I just want the month and year from the user which will be stored in database in MM/yyyy fomat (varchar).
    Appreciate any one has a solution for this. (I've even tried with RadDatePicker; the behavior is same as the RadDateInput)



  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 May 2009 Link to this post

    Hello Prashanth,

    I tried this scenario with the RadDateInput control and it doesnt seem to work but i was able to make it work with my RadDatePicker control just that only the DisplayDateFormat should be set to MM/yyyy and the DateFormat property need not be set.
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
               <DateInput DisplayDateFormat="MM/yyyy"></DateInput> 

  3. Denis Susac
    Denis Susac avatar
    2 posts
    Member since:
    Aug 2005

    Posted 28 Dec 2009 Link to this post


      we have same problem with date picker input, the solution Princy suggested isn't working as expected. If you enter a date in "MM/yyyy" (05/2009) format, leave the input box and then go back to input box then you will have date in following format  "MM/dd/yyyy" (12/05/2009) so basically your month is switched with your date in input format.

    Any suggestions on how to fix the issue ?
  4. Dimo
    Dimo avatar
    8485 posts

    Posted 28 Dec 2009 Link to this post


    When you enter two numbers in the DateInput control (one of which is the year), it always assumes that one number is the year and the other one is the day (and takes the current month). In your case I suggest you to use the following configuration.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <head runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>RadControls for ASP.NET AJAX</title>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadDatePicker ID="RadDatePicker2" runat="server">
        <DateInput ID="DateInput1" runat="server" DateFormat="MM/dd/yyyy" DisplayDateFormat="MM/yyyy">
            <ClientEvents OnValueChanging="MyValueChanging" />
    <script type="text/javascript">
    function MyValueChanging(sender, args)
        var newv = args.get_newValue();
        var newvArray = newv.split("/");
        if (newvArray.length == 2)
            // if the date format is dd/MM/yyyy, the 01 string should be appended in the beginning, not in the middle
            args.set_newValue(newvArray[0] + "/01/" + newvArray[1]);

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Dec 2009 Link to this post

    Hello Denis,

    You could refer to the following forum discussion wherein Martin has given a clear idea of this issue. Check it out:
    DatePicker Format Issue

    Hope this helps..
Back to Top