I have a date in the form of "month/day/year" which is obtained from the form. I initialize the value to a variable, say $activation_date.
Code: Select all
$activation_date = $_POST['activation'];
Now I want to calulcate the date after '$validity' days, where the variable holds the number of days. First i need to make an epoch time stamp of the activation_date using mktime() ,and use strtotime() to calculate the final date value.
Code: Select all
$exploded_date = explode("/", $activation_date);
$epoch_date = mktime(0, 0, 0, $exploded_date[0], $exploded_date[1], $exploded_date[2]);
$ending_day = strtotime("+$validity day", $epoch_date);
What I try to do is, eplode the date using "/" as the delimeter. For example, if the date is 06/12/2006, when i explode it becomes $exploded_date = array('06'.'12',2006'). And using this array, i make a epoch time stamp in the next step and in the last step i make use of the strtotime() to calculate the date after the $valdiity_day.
But, am not getting the output for the explode() function. When i try to echo the variable, its jus ehcoing "Array".
Any better ways to do the sutff ? Where am I going wrong ?