I use:
$today = date(“F – j – Y”);
however I want to add a certain number of days to it.
Like: $nextweek = 7
How can I add those 7 days to the current date? and still keep it in the same format.
this function u can use with MySQL database
Code:
function dt_only_date_minus_x_days( $x ) { return date("Y-m-d", time( ) - ( $x * 24 * 60 * 60 ) ); } function dt_minus_x_days( $x ) { return date("Y-m-d G:i:s", time( ) - ( $x * 24 * 60 * 60 ) ); }function dt_now( ) { return dt_minus_x_days( 0 ); } function dt_yesterday( ) { return dt_minus_x_days( 1 ); } Try his one
Code:
$time = time() + (7 * 24 * 60 * 60); print $today = date("F - j - Y"); # today print $today = date("F - j - Y", $time); # next week I think this will be useful for u
Code:
date("F - j - Y", strtotime('+1 week'));