This is a migrated thread and some comments may be shown as answers.

How Get Date From Date Picker In Diffrent Date Format

3 Answers 953 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Chandan Kumar
Top achievements
Rank 1
Chandan Kumar asked on 14 Jul 2010, 08:33 AM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jul 2010, 11:25 AM
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.
0
Chandan Kumar
Top achievements
Rank 1
answered on 14 Jul 2010, 11:40 AM
<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.
0
Radoslav
Telerik team
answered on 19 Jul 2010, 09:21 AM
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
Tags
Calendar
Asked by
Chandan Kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Chandan Kumar
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or