1

I'm trying to set the datepicker up with a format like this

$("#date").datepicker({
dateFormat: 'date_yyyy-mm-dd'
});

I want it to output "date_2017-08-22" but the issue is that it outputs "22ate_20172017-08-22". Why is it doing that?

2

1 Answer 1

2

The d in date is considered as a day hence the 22 at the beginning, as for the years each 'yy' represents a year if you put 'yyyy' it will print two years as it did in you example, you can use single quotes to put literal text as follows:

$("#date").datepicker({
dateFormat: "'date_'yy-mm-dd"
});

You can check more documentation here, good luck.

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

1 Comment

Awesome thank you so much, I upvoted it but it doesnt show up yet.

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.