raddatepicker format date

12 posts, 0 answers
  1. goxel
    goxel avatar
    9 posts
    Member since:
    Jan 2009

    Posted 03 Mar 2009 Link to this post

    Hi

    İ m using datepicker, i want to format selected date as dd/mm/yyyy. but if day is one digit, zero must come in front of day number. for example if i select 3 may 1999, selected date must be 03/05/1999 not 3/5/1999, how can i do this?

    thanx
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Mar 2009 Link to this post

    Hello Goxel,

    Set the DateFormat to "dd/MM/yyyy" in order to achieve this. See the example below.

    ASPX:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Culture="English (United States)">         
                <DateInput DateFormat="dd/MM/yyyy"
                </DateInput> 
    </telerik:RadDatePicker> 
    Checkout the link which explains about Formatting Values for RadDatePicker.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lobna
    Lobna avatar
    14 posts
    Member since:
    Jan 2013

    Posted 01 Feb 2014 Link to this post

    I want to ask if raddatepicker can show Arabic(Hijri) date or not.

    Thanks,
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Feb 2014 in reply to Lobna Link to this post

    Hi Lobna,

    As a work around please try the following code snippet.

    ASPX:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Culture="Arabic">
        <DateInput ID="DateInput1" DateFormat="G" DisplayDateFormat="G" runat="server">
        </DateInput>
    </telerik:RadDatePicker>

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadDatePicker1.DateInput.Culture.DateTimeFormat.Calendar = new GregorianCalendar();
    }

    Thanks,
    Shinu.
  6. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 29 Oct 2014 Link to this post

    I'm trying to set the dateFormat to dd/MM/yyyy but it changes to dd/MM/yyyy HH:mm when the control loses its focus

    I tested these combinations ("dd", "dd/MM", "dd/MM/yy") and they worked fine but with "dd/MM/yyyy" the control add a time part that i don't want...

    Is there something i can do? Also I'm not setting cultures.

    <telerik:RadDateTimePicker
        ID="dtpDate" runat="server" Width="49.5%"
        DateInput-InvalidStyle-CssClass="invalid"
        DatePopupButton-Visible="true"
        TimePopupButton-Visible="False">
        <DateInput DateFormat="dd/MM/yyyy" />
    </telerik:RadDateTimePicker>

  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 03 Nov 2014 Link to this post

    Hi Romulo,

    Could you please setting the DisplayDateFormat as well and let me know about the result?
    <DateInput DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy" />

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 03 Nov 2014 Link to this post

    Hi Kostadin,

    The behavior was the same.

    I tried setting directly on the control on the page and programatically, but it was the same thing.


    I forgot to mention, I'm using the DatetimePicker inside an UserControl, also i'm exposing these properties. Can it be the problem?
  9. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 06 Nov 2014 Link to this post

    Hello Romulo,

    Could you please provide your mark-up and code behind which represent your current implementation of the control. This might help me replicate the issue locally and provide you with a proper solution.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 10 Nov 2014 Link to this post

    Hi Kostadin,

    Sorry for not posting earlier...

    the ascx is like that:

    <telerik:RadDateTimePicker
                ID="dtpDateTime" runat="server" Width="100%"
                DatePopupButton-Visible="true" TimePopupButton-Visible="true"
                TimeView-Culture="pt-BR" 
                Calendar-Culture="pt-BR" Calendar-CultureInfo="pt-BR" />


    I set the "DateInput.DateFormat" property like this:

    public string DateTimeFormat
    {
        get { return dtpDateTime.DateInput.DateFormat; }
        set { dtpDateTime.DateInput.DateFormat = value; }
    }

    I also tried the DisplayDateFormat property with this, but the behavior didn't change

    The string is based on the formats available on the documentation, for example: "dd/MM/yyyy", "HH:mm", but as mentioned before, the format "dd/MM/yyyy" that I was planning for default makes it appears like "dd/MM/yyyy HH:mm:ss" but other string formats are OK

    I also tried removing that culture properties, but I don't think they are the problem... (also, I'm setting tooltips and localization strings in some properties in the ascx part, but again, I don't think they are the problem too).

    Thanks



  11. Brian Brown
    Brian Brown avatar
    5 posts
    Member since:
    Apr 2010

    Posted 12 Nov 2014 Link to this post

    I have basically the same question/issue.   I have a datetimepicker that in some cases I dont want the time portion to be displayed - meaning i only want to see the format "dd/MM/yyyy".   Every time I set the DateFormat and DisplayDateFormat to this it formats the date as intended but always still shows the time portion.  So really what I'm wondering is - is there a way to format the DisplayDate so it does not show the time?
  12. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 13 Nov 2014 Link to this post

    Hi Romulo,

    I examine the provided code and I was unable to find the part where you set the DisplayDateFormat property. You need to set this property as well in order to display the chosen format in the input element. Please check out the following code snippet.
    public string DateTimeFormat
        {
            get {
                return dtpDateTime.DateInput.DateFormat;
            }
            set {
                dtpDateTime.DateInput.DateFormat = value;
                dtpDateTime.DateInput.DisplayDateFormat = value;
            }
        }

    Hi Brian,

    I am afraid I am still not able to replicate the issue locally when both properties are set.
    I would appreciate if you can provide the code of a small sample in order to investigate the issue locally. Here I attached a small runnable sample based on the Romulo code which work correctly on my end. You can try replicate the issue in the sample and just let me know what I should change.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  13. Brian Brown
    Brian Brown avatar
    5 posts
    Member since:
    Apr 2010

    Posted 13 Nov 2014 in reply to Kostadin Link to this post

    Thanks for your example...  I managed to get it working.   I am adding the DTP to the panel programmatically and I was setting the format before adding it..  I discovered that for some reason I have to add the object to the panel, and then set the format. 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017