0

Hello i am working with a small application where user selects a week day from this select option:

   <select name="selectOption" class="dropdown-select">
      <option value="">Select a day!</option>
      <option value="Monday">Monday</option>
      <option value="Tuesday">Tuesday</option>
      <option value="Wednesday">Wednesday</option>
      <option value="Thursday">Thursday</option>
      <option value="Friday">Friday</option>
      <option value="Saturday">Saturday</option>                            
   </select>

When i store it in a variable i get this : $selectedDay = $_POST['selectOption']; //Monday,Tuesday etc. From this point i want to convert this day into server's current week date. For example when a user selects Thursday i want to convert it into 16-04-2015 because it is the current week's date for Thursday. It should only work for the current week. I could have used date picker straight forward but i want it to happen this way. Can anyone help?

Md Sakib
  • 101
  • 2
  • 2
  • 7
  • possible duplicate of [JQuery Datepicker with text input that doesn't allow user input](http://stackoverflow.com/questions/153759/jquery-datepicker-with-text-input-that-doesnt-allow-user-input) – Tui Popenoe Apr 13 '15 at 20:04

1 Answers1

2

You can use strtotime() and date():

echo date('d-m-Y', strtotime('this Thursday'));
developerwjk
  • 8,619
  • 2
  • 17
  • 33