PHP code example of tomkyle / datetime

1. Go to this page and download the library: Download tomkyle/datetime library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tomkyle / datetime example snippets



use \tomkyle\DateTime\MySqlDateTimeFormatter;

$now = new \DateTime("now");

// prints s'th. like "2014-04-09 15:00:00"
echo new MySqlDateTimeFormatter( $now );

// prints s'th. like "2014-04-23 15:00:00"
echo new MySqlDateTimeFormatter( new \DateTime( "14day" ));