Why doesn't "yyyyMMdd" work as a date format?

3 posts, 1 answers
  1. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 03 Oct 2013 Link to this post

    I've got my DatePicker (and calendar and input), but it doesn't work with this "yyyyMMdd" format. It works with spaces or characters between, but not all together. Why not? When I try to use this format and pick a date from the calendar, the input part gives me the little warning sign. Some relevant code:

    <telerik:RadCalendar runat="server" ID="RadCalendar"/>
    <telerik:RadDatePicker runat="server" ID="rdpRequestDate" SharedCalendarID="RadCalendar">>
          <DateInput DateFormat="yyyyMMdd" DisplayDateFormat="yyyyMMdd" />
    </telerik:RadDatePicker>
  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 07 Oct 2013 Link to this post

    Hello,

    With the current implementation of RadDatePicker you will not be able to set the DateFormat to "yyyyMMdd" directly. Nevertheless, you could try the following workaround that will allow you to use "yyyyMMdd" as DateFormat:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function setDateFormat(sender, args) {
                sender.set_dateFormat("yyyyMMdd");
            }
        </script>
    </telerik:RadCodeBlock>
     
    <telerik:RadCalendar runat="server" ID="RadCalendar1"/>
    <telerik:RadDatePicker runat="server" ID="rdpRequestDate" SharedCalendarID="RadCalendar1">
        <DateInput runat="server" DateFormat="yyyy MM dd" DisplayDateFormat="yyyyMMdd" ClientEvents-OnLoad="setDateFormat"/>
    </telerik:RadDatePicker>

    Hope that helps.

     

    Regards,
    Konstantin Dikov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 08 Oct 2013 Link to this post

    Thanks, Konstantin! That should work okay!
Back to Top