parmarmayur9090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

datePicker dateFormat problem #275

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello good people :)

I have a problem with the datePicker that I am trying to solve for 2 days now.

Looked at all the tutorials and posts but nothing helped.

My problem is that I want the datePicker to return the date as: dd/mm/yyyy and 
whatever I tried, the input field that gets the selected date displays it as: 
Tue Apr 26 2011 00:00:00

Here is my code:

Copy code

   1. <head>
        <script src="../js/jquery.min.js"></script>
          <script type="text/javascript" src="../js/datePicker/date.js"></script>
        <script type="text/javascript" src="../js/datePicker/jquery.datePicker.js"></script>

        <script type="text/javascript">
         $(function()
         {
                  $('.dp')
                      .datePicker({inline:true})
                      .bind(
                          'dateSelected',
                          function(e, selectedDate, $td)
                          {
                              $('.date').val(selectedDate);
                          }
                      );
            });

      </script>
      <link href="../js/datePicker/datePicker.css" rel="stylesheet" type="text/css">
      </head>
      <body>
      <form method="post">
      <div class="dp"></div>
      Date: <input type="text" class="date"></input>
      </form>

      </body>

I am using Windows 7, Firefox 3.6.16, I've just downloaded datePicker so I 
guess I am using the latest version, maybe 103? Not sure

The site is a local website, so I can't send a link to it.

Original issue reported on code.google.com by cgu...@gmail.com on 22 Apr 2011 at 6:13

GoogleCodeExporter commented 8 years ago
dateSelected gets a javascript Date object sent to is. So you can do 
selectedDate.asString() to get it in the format set in Date.format...

Original comment by kelvin.l...@gmail.com on 25 Apr 2011 at 10:37