I have a date picker option on my website where I have to pick up a date for after 2 weeks from current date, how do I do that using java programming language?

  • 1
    Do you know how to do it in some other programming language?
    – user246
    May 23, 2015 at 21:31
  • Can you how that site so I can see data picker and then can help you to get value from date picker. May 25, 2015 at 3:01

1 Answer 1


The below code should give you two weeks from the current date

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    Calendar c = Calendar.getInstance();
    c.setTime(new Date()); // Use today date
    c.add(Calendar.DATE, 14); // Adding 14 days which is two weeks from the current date
    String output = sdf.format(c.getTime());

Selecting this date from the date picker will require knowing what type of date picker is used in your website.

Check out the below link for more on how to select if using selenium https://stackoverflow.com/questions/21398575/select-a-date-from-date-picker-using-selenium-webdriver

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.