locked
Difference between ajax datepicker and jquery datepicker RRS feed

  • Question

  • User219039814 posted

    What is the difference between ajax datepicker and jquery one.

    I am working with jquery datepicker..

    string fromdate = Request.Form["fromdate"];     // getting the datepicker date
    Response.Write(fromdate);  //date printed in the form   m/dd//yyyy
    DateTime dt11 = Convert.ToDateTime(fromdate);


    Response.Write(dt11);  //prints in m-dd-yyyy format

    I want to know if jquery datepicker should be set to a certain format for me to convert to datetime object??

    Saturday, June 30, 2018 6:54 AM

Answers

  • User36583972 posted


    Hi vijaylakshmi,

    I want to know, no matter what format i use in datepicker, will i get it  in code behind using datetime object.??

    No, The following format, we need to pay attention.

     $("#datepicker").datepicker({
                    dateFormat: '\'day\' d \'of\' MM \'in the year\' yy ',
                });
    

    You can refer the other formats in DatePicker and make a test on your side.
    http://jqueryui.com/datepicker/#date-formats

    We can use the following code to convert a string to datetime.

                string timevalue = Request.Form["datepicker"];
                DateTime daDate = Convert.ToDateTime(timevalue );


    The following links may helpful for you.

    Simplest Way to Use JQuery Date Picker and Date Time Picker in ASP.NET/ASP.NET MVC:
    https://www.codeproject.com/Articles/1136464/Simplest-Way-to-Use-JQuery-Date-Picker-and-Date-Ti

    Best Regards,

    Yong Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 2, 2018 9:56 AM

All replies

  • User-821857111 posted

    You can specify the format using the format option:

    $('#fromDate').datepicker({format: 'yyyy-mm-dd'});

    That's the format I use so that there is no confusion with dd/MM/yyy and MM/dd/yyyy

    Saturday, June 30, 2018 9:07 AM
  • User219039814 posted

    Yes sir, i have no problems with that..

    I want to know, no matter what format i use in datepicker, will i get it  in code behind using datetime object.??

    and also.. what is the difference between

    Datetime obj = new DateTime();

    obj = Convert.toString(str);    // str is the variable which contains the datepicker date.

    &&&&&&&&&&&&&

    Datetime obj = Convert.toString(str);      

    What is the difference in their declaration??

    Saturday, June 30, 2018 9:16 AM
  • User36583972 posted


    Hi vijaylakshmi,

    I want to know, no matter what format i use in datepicker, will i get it  in code behind using datetime object.??

    No, The following format, we need to pay attention.

     $("#datepicker").datepicker({
                    dateFormat: '\'day\' d \'of\' MM \'in the year\' yy ',
                });
    

    You can refer the other formats in DatePicker and make a test on your side.
    http://jqueryui.com/datepicker/#date-formats

    We can use the following code to convert a string to datetime.

                string timevalue = Request.Form["datepicker"];
                DateTime daDate = Convert.ToDateTime(timevalue );


    The following links may helpful for you.

    Simplest Way to Use JQuery Date Picker and Date Time Picker in ASP.NET/ASP.NET MVC:
    https://www.codeproject.com/Articles/1136464/Simplest-Way-to-Use-JQuery-Date-Picker-and-Date-Ti

    Best Regards,

    Yong Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 2, 2018 9:56 AM