This question has already been answered:
- How to add time Php 2 answer
How to add to the age of a few days? In this question I looked at how to find out age: how to find out age and how to add a few days to age?
This question has already been answered:
How to add to the age of a few days? In this question I looked at how to find out age: how to find out age and how to add a few days to age?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
Based on the fact that you watched DateTime
, you can follow the tradition, go ahead and look:
DateTime :: modify () → Change Timestamp
Object oriented style
<?php $date = new DateTime('2006-12-12'); $date->modify('+1 day'); echo $date->format('Ym-d'); ?>
Procedural style
<?php $date = date_create('2006-12-12'); date_modify($date, '+1 day'); echo date_format($date, 'Ym-d'); ?>
The result of these examples:
2006-12-13
Actually, instead of +1 day
can be different numbers, and you can add / subtract not only the day, but also the month, year, etc.
$neskolkoDnyamiPozhe = date("jnY", strtotime($vozrast)+10*86400);//+10 дней к возрасту
if $ vozrast, this is the date as text
Source: https://ru.stackoverflow.com/questions/553051/
All Articles