Memory App
Programming
 




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
(1/4)

Get interval


<?php
    $datetime1 = new DateTime("2018-10-20");
    $datetime2 = new DateTime("2018-10-30");

    echo $days = $datetime2->diff($datetime1)->format('%R%a'); // -10
(2/4)

First day of last month


<?php
    $query_date = '2010-02-04';
    $date = new DateTime($query_date);
    $date->modify('first day of this month');
    $firstday= $date->format('Y-m-d');
(3/4)

Page loading time - https://www.php.net/manual/en/function.microtime.php


<?php
        // start of the request with microsecond precision (REQUEST_TIME_FLOAT)

        echo microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; 
http://php.net/manual/ro/datetime.add.php http://php.net/manual/ro/datetime.diff.php

Questions



Top Reference > Programming
0/0 (80)  
Not Logged