php add 1 day to current date

There are many methods to add days to $Date. The smart way to add days to $Date is using built-in functions like strtotime(), date_add() in PHP.
1 Using strtotime() Function:
We use the strtotime() Function to change an English textual date-time style into a UNIX timestamp.
The two parameters accepted by this function are described here.
The $EnglishDateTime identify the English textual date-time representation, which describes the date or time to be restored.
Output:
2019-05-20

php add days to date

on Jan 01, 1970
$start_date = "2015/03/02";  
$date = strtotime($start_date);
$date = strtotime("+7 day", $date);
echo date('Y/m/d', $date);

Add Comment

1

php date strtotime add days

on Jan 01, 1970
// add 1 day to the date above
$n = date('Y-m-d', strtotime( $d . " +1 days"));

// add 1 month to the date above
$n = date('Y-m-d', strtotime( $d . " +1 month"));

// add 1 year to the date above
$n = date('Y-m-d', strtotime( $d . " +1 year"));

// subtract 1 day to the date above
$n = date('Y-m-d', strtotime( $d . " -1 days"));

// subtract 1 month to the date above
$n = date('Y-m-d', strtotime( $d . " -1 month"));

// subtract 1 year to the date above
$n = date('Y-m-d', strtotime( $d . " -1 year"));

Add Comment

0

add 1 day php datetime

on Jan 01, 1970
$date = new DateTime('2000-01-01');
$date->add(new DateInterval('P1D'));

Add Comment

0

PHP add 1 day to current date

on Jan 01, 1970
echo date('j F, Y',strtotime("+1 days"));

Add Comment

0

PHP Date add days

on Jan 01, 1970
$date = date('Y-m-d', strtotime("+1 day"));

Add Comment

0

php strtotime plus 1 day

on Jan 01, 1970
$NewDate = date('Y-m-d', strtotime('+7 days'));

Add Comment

0

2 Using date_add() Function:
This function is used to add days, years, months, hours, seconds, and minutes.
There are two methods accepted by this function.
Object:
This parameter identifies the DateTime article restored by date_create() function.
Interval:
This parameter describes the object of DateInterval.
Output:
2019-05-20

PHP answers related to "date 1"

View All PHP queries

PHP queries related to "date 1"

Browse Other Code Languages

CodeProZone