MemoryRefresh!

Datetime



Questions 1 Answers 0%

Pages   0 from 51
Questions   0 from 84

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
http://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
http://php.net
Questions

Related pages

Basics !
Comparing !
Searching !
Parse !
Replacing !
Formatting !
Printf !
Regexp !
Datetime !


0% 100%
 
 
0 pages 51 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");




Last Review: n/a   Passed: n/a   Reviews: n/a   Next Review: n/a  


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
http://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
http://php.net



More from Php

Basics
Variables
Operators
Function
Array
String
Streams
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com