Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need help and suggestion to built algorithm to get set date in PHP.

the situation is like this.

If Ronney select days 1<15 then the active date is (1/nxt month/2016)
if Ronney select days 15>31 then the active date is (15/next month/2016)

What I have tried:

PHP
$date = date('Y-m-d');
$date = date('Y-m-d', strtotime('+1 month', strtotime($date)))


But i want set
PHP
day
also..
Posted
Updated 20-Dec-16 9:58am

1 solution

Try this:
$day = 21;
$d=strtotime("+1 Months");
if($day < 15)
	echo date("1/m/Y", $d);
else
	echo date("15/m/Y", $d);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900