2

When i set my input field without datepicker like that:

<input type="text" name="date" value="<?php echo $date; ?>" class="textbox" />

I can see my value which i get from database. The format is: 1965-02-05

When I set this code:

    <script>
    $(function() {
        $( "#datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true
        }
            );
                $( "#datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" );
                $( "#datepicker" ).datepicker( "option", "yearRange", '1900:2011' );
    });
    </script>
<input type="text" id="datepicker" name="date" value="<?php echo $date; ?>" class="textbox" />

nothing shown in text input area, but i can see datepicker without any problem when i click inside of the text input area.

What is the problem? I'am formatting like that:

http://docs.jquery.com/UI/Datepicker/formatDate

1
  • please don't say to make this format: yyyy-mm-dd one y describes two digits. Commented Oct 26, 2011 at 23:20

1 Answer 1

3
$( "#datepicker" ).datepicker({
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-mm-dd',
    yearRange: '1900:2011',
    constrainInput: false 
});

See working example: http://jsfiddle.net/eATRv/

Try this. Now you should also be able to see if it is the correct format :)

Sign up to request clarification or add additional context in comments.

4 Comments

try pasting the value of the input field :)
Does this -> jsfiddle.net/eATRv not work in your browser? Please paste the input value you get from your code
It works on my browser bu not working in my code i did not solve the problem than i switch to that plug-in keith-wood.name/datepick.html it works now...
Heh ok. Sure that none of the other plugins you use interfere with it? JQUI Datepicker is such a nice plugin :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.