I am working on a project in which i have to Generate a Date from Selected Option value.
Example:
- If selected
1.5then need a date after 1 Month 15 days15-08-2017 If selected
1.0then need a date after 1 Month17-08-2017<select class="form-control" name="days" id="days" required> <option data-days="1.5" value="3">After 1 month 15 days</option> <option data-days="2.5" value="4">After 2 month 15 days</option> <option data-days="6.0" value="10">After 5 month</option> <option data-days="7.5" value="30">After 7 month 15 days</option> //And So on... </select> // Here is the script for getting selected option days attribute. $('body').on('change', '#days', function(e) { var days = $(this).find(':selected').data('days'); // Now How do i get the date according the days. as shown in example });
I have also tried to get the date in PHP but i didn't get it.
$date = date('Y-m-d', strtotime('+1.0 month'));
So can anyone help me to get date using this float numbers in PHP or Jquery.