Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Adding or Subtracting Time

$dateTime = new DateTime('2016-01-01');
$dateTime->modify('+1 day');
echo $dateTime->format('Y-m-d H:i:s');`
# Output: 2016-01-02 00:00:00

# You can as well use the constructor if you work on the current date:



$dateTime = new DateTime('+1d');
echo $dateTime->format('Y-m-d H:i:s');`
# Output the current date plus one day.
 
PREVIOUS NEXT
Tagged: #Adding #Subtracting #Time
ADD COMMENT
Topic
Name
5+8 =