File: fwphp/glomodul/z_examples/book_video/gallery_powers/date_modify.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/gallery_powers/date_modify.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/gallery_powers/date_modify.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 448 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>Modify Dates</title>
</head>

<body>
<?php
$format
= 'F j, Y';
$date = new DateTime('January 31, 2019');
?>
<p>Original date: <?= $date->format($format) ?>.</p>
<p>Add one month: <?php
    $date
->modify('last day of +1 month');
    echo
$date->format($format);
   
$date->modify('last day of -1 month');
   
?>
<p>Subtract one month: <?= $date->format($format) ?>
</body>
</html>

For more information send a message to info at phpclasses dot org.