Add day, minus day, Add month, minus month, Add year, minus year, first day, last day.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<? $current_date = "2017-02-07"; // Add day $next_date = date("Y-m-d", strtotime('+1 days', strtotime($current_date)) ); // Minus day $prev_date = date("Y-m-d", strtotime('-3 days', strtotime($current_date)) ); // Add month $next_month_date = date("Y-m-d", strtotime('+1 months', strtotime($current_date)) ); // minus month $prev_month_date = date("Y-m-d", strtotime('-3 months', strtotime($current_date)) ); // Add year $next_year_date = date("Y-m-d", strtotime('+1 year', strtotime($current_date)) ); // minus year $prev_year_date = date("Y-m-d", strtotime('-3 year', strtotime($current_date)) ); // First day $first_day = date('Y-m-d', strtotime("first day of ",strtotime($current_date))); // Last day $last_day = date('Y-m-d', strtotime("last day of ",strtotime($current_date))); ?> |
More Stories
CPU & Memory usage in PHP
Install PHP mcrypt extension on Ubuntu
Text to speech