Rad Date Picker format saving in M/D/YYYY

3 posts, 1 answers
  1. Brandon
    Brandon avatar
    17 posts
    Member since:
    Sep 2011

    Posted 28 Nov 2011 Link to this post

    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. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Nov 2011 Link to this post

    Hello,

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

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brandon
    Brandon avatar
    17 posts
    Member since:
    Sep 2011

    Posted 29 Nov 2011 Link to this post

    Good idea! It worked perfectly.

    Thanks for your help!
Back to Top