4
votes

So I have a date picker and I want to get back a max date. I have somthing like this

$( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +15D" });

how can I get the maxDate value formatted in MM/DD/YYYY?

Thanks for your help guys

2
So the main question is I have a datepicker and I want to get back the date 6 weeks from today. How do I get that date in a string? - climboid
i'm not sure there is a way to do this using the datepicker api. the getter for maxDate will just return what you gave it, so that's not going to help. you might need to use a library like date.js - Patricia
date.js looks awesome... if no one responds to a solution with datepicker I think you are correct =) - climboid

2 Answers

6
votes
$('#datepicker').datepicker( "option", "dateFormat", 'mm/dd/yyyy' );

And then specify your maxdate in mm/dd/yyyy.

2
votes

I am pretty sure this is what I used: { maxDate: '+2m +2w +4y' }