-1

Hi I am trying to format the jquery datepicker so that it displays as yyyy-mm-dd

I have both a start_date and end_date..

I have tried changing the script in the head to:

    <script>
          $(function() {
            $( "#datepicker" ).datepicker();
            $( "#datepicker" ).datepicker({dateFormat: 'yy-mm-dd'});
  });
  </script>

however it still appears when I am trying to put it in a database as 00-00-000

I would really appreciate any help!

Ryan

Ryan
  • 13
  • 1
  • 1
  • 6
  • I know that jQuery has many plugins, but I've never seen the phpmyadmin plugin for it let alone any mysql client library. – M8R-1jmw5r Apr 15 '13 at 22:04
  • 1
    need to see the php script you have doing the the db stuff –  Apr 15 '13 at 22:05

1 Answers1

1
$(function(){
    $("#to").datepicker({ dateFormat: 'yy-mm-dd' });
    $("#from").datepicker({ dateFormat: 'yy-mm-dd' }).bind("change",function(){
        var minValue = $(this).val();
        minValue = $.datepicker.parseDate("yy-mm-dd", minValue);
        minValue.setDate(minValue.getDate()+1);
        $("#to").datepicker( "option", "minDate", minValue );
    })
});

http://jsfiddle.net/gaby/WArtA/

Pete Naylor
  • 776
  • 2
  • 14
  • 33
  • 1
    You've missed to place the link where you obtained that code from. – M8R-1jmw5r Apr 15 '13 at 22:05
  • how would i format the input for the from and to dates? – Ryan Apr 15 '13 at 22:06
  • 2
    If that is the accepted answer, then this question is [a duplicate](http://stackoverflow.com/q/7500058/2261774) ([as the answer is](http://stackoverflow.com/a/7500139/2261774)). @Pete Naylor: ***Please do not duplicate content*** - leave a comment instead with the link. – M8R-1jmw5r Apr 15 '13 at 22:31