How to change date format using jquery?

How to change date format using jquery in asp.net?

  • I want to change date format using jquery when user select date then text box contain date as yy/mm/dd format I was write some code hear <script src="content/dist/js/jquery-1.8.3.js" type="text/javascript"></script> <script src="content/dist/js/jquery.ui.datepicker.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("[id$=txtDate]").datepicker({dateFormat: 'yy/mm/dd'}); }); </script> aspx code : <asp:TextBox ID="txtDate" CssClass="form-control" runat="server" placeholder="Enter Date" TabIndex="7" ></asp:TextBox>

  • Answer:

    You can change the format in c#. Use this code : txtDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

jayesh dhameliya at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.