How Get Date From Date Picker In Diffrent Date Format

4 posts, 0 answers
  1. Chandan Kumar
    Chandan Kumar avatar
    68 posts
    Member since:
    Mar 2010

    Posted 14 Jul 2010 Link to this post

    Sir,

        How can i get diffrent date format from Date Picker.

    For Example if  Date Time Picker Format is "dd/MM/yyyy" and i want to get Its "yyyy/MM/dd" format. How can i get it.


    1 more Problem when raddate time picker i set date format "MM/dd/yyyy hh:mm" Then It shows month in single digit format.

    Means When Date is "07/15/1986" Then It autometicaly converted "7/15/1986" So i want two digit in month Format.

    Please Help Me .

    Thanks
    Chandan

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

    Posted 14 Jul 2010 Link to this post

    Hello,

    You can format the selected date from code behind as shown below.

    CS:
    string str = RadDateTimePicker1.SelectedDate.Value.ToString("yyyy/MM/dd");
    Response.Write(str);



    And for displaying the DateFormat, try setting the DisplayDateFormat for the RadDateTimePicker ->  DateInput.
    ASPX:
    <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">
        <DateInput DateFormat="MM/dd/yyyy hh:mm" DisplayDateFormat="MM/dd/yyyy hh:mm">
        </DateInput>
    </telerik:RadDateTimePicker>


    -Shinu.
  3. Chandan Kumar
    Chandan Kumar avatar
    68 posts
    Member since:
    Mar 2010

    Posted 14 Jul 2010 Link to this post

    <telerik:RadDateTimePickerID="RadDateTimePicker1"runat="server">
        <DateInputDateFormat="MM/dd/yyyy hh:mm"DisplayDateFormat="MM/dd/yyyy hh:mm">
        </DateInput>
    </telerik:RadDateTimePicker>


    I Have already put this code but its working But problem is as below.

    it display as "7/15/1985 10:15"

    it should display as "07/15/1985 10:15"

    it dispaly month in single digit. please help me.
  4. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 19 Jul 2010 Link to this post

    Hi Chandan,

    I try to reproduce the described issue, but to no avail. On the following link I uploaded the video which shows the described scenario, however the date string is set as expected.
    Additionally I am sending you a simple example, could you please check it out and let me know what differs in your case.

    Sincerely yours,
    Radoslav
    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
Back to Top