Answers for "how to match + 1 day and time function in php"

PHP
5

php date + one day

<?php
$stop_date = '2009-09-30 20:24:00';
echo 'date before day adding: ' . $stop_date; 
$stop_date = date('Y-m-d H:i:s', strtotime($stop_date . ' +1 day'));
echo 'date after adding 1 day: ' . $stop_date;
?>
Posted by: Guest on December-09-2019
0

in date function + 1 month and - 1 day in php

<?php
$months = n; // Here n = …..-2,-1,0,1,2, …..(months to add or subtract)
$years = n;  // Here n = …..-2,-1,0,1,2, …..(years to add or subtract)
echo date('Y-m-28', mktime(0, 0, 0, date('m')+$months, 1, date('Y') + $years));
?>
Posted by: Guest on October-13-2020

Browse Popular Code Answers by Language