Quote:
Originally Posted by tertius 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 );
}