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

Rad Date Picker format saving in M/D/YYYY

2 Answers 482 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 28 Nov 2011, 11:40 PM
I'm using the rad date picker control. I want the entered date to save in the database as MM/DD/YYYY.

In html I have:
<DateInput runat="server" DateFormat="MM/dd/yyyy"  DisplayDateFormat="MM/dd/yyyy"> 

It displays in MM/DD/YYYY, but will only save as M/D/YYY.


I am using this code to get the value entered into the picker:
DatePicker.SelectedDate.Value.ToShortDateString();

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 29 Nov 2011, 05:14 AM
Hello,

You can try the following.
CS:
string s1 = String.Format("{0:MM/dd/yyyy}", picker.SelectedDate);

Thanks,
Princy.
0
Brandon
Top achievements
Rank 1
answered on 29 Nov 2011, 02:45 PM
Good idea! It worked perfectly.

Thanks for your help!
Tags
Calendar
Asked by
Brandon
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Brandon
Top achievements
Rank 1
Share this question
or