MemoryRefresh!

String / Datetime   Datetime



Questions 1 Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


Add days
<?php $datetime1 = new DateTime("2018-10-20"); $days = 7; $datetime2 = $datetime1->add(new DateInterval("P{$days}D")); echo $datetime2->format("d-m-Y"); // 27-10-2018 php.net Get interval
<?php $datetime1 = new DateTime("2018-10-20"); $datetime2 = new DateTime("2018-10-30"); echo $days = $datetime2->diff($datetime1)->format('%R%a'); // -10 php.net

Related Pages

Basics
Comparing
Searching
Parse
Replacing
Formatting
Printf
Regexp
Datetime


0% 100%
 
 
0 pages 91 pages
1) Add 7 days to a datetime object. <?php $datetime1 = new DateTime("2018-10-20"); $datetime1->add(______________);




2) Get days interval. <?php $datetime1 = new DateTime("2018-10-20"); $datetime2 = new DateTime("2018-10-30");







Add days
<?php $datetime1 = new DateTime("2018-10-20"); $days = 7; $datetime2 = $datetime1->add(new DateInterval("P{$days}D")); echo $datetime2->format("d-m-Y"); // 27-10-2018 php.net Get interval
<?php $datetime1 = new DateTime("2018-10-20"); $datetime2 = new DateTime("2018-10-30"); echo $days = $datetime2->diff($datetime1)->format('%R%a'); // -10 php.net

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References