PHP code example of indieweb / date-formatter

1. Go to this page and download the library: Download indieweb/date-formatter 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/ */

    

indieweb / date-formatter example snippets


echo IndieWeb\DateFormatter::format('2013-10-08T07:00:00-07:00', '2013-10-08T17:00:00-07:00');

echo IndieWeb\DateFormatter::format('2013-10-08', '2013-10-11');

use IndieWeb\DateFormatter;

echo DateFormatter::format('2013-09-03', '2013-09-08');
// September 3-8, 2013

echo DateFormatter::format('2013-09-28', '2013-10-03');
// September 28 through October 3, 2013

echo DateFormatter::format('2013-12-30', '2014-01-02');
// December 30, 2013 through January 2, 2014

use IndieWeb\DateFormatter;

echo DateFormatter::format('2013-10-08T07:00:00-07:00', '2013-10-08T17:00:00-07:00');
// October 8, 2013 from 7:00am to 5:00pm (-0700)

echo DateFormatter::format('2013-10-08T07:00:00-07:00', '2013-10-10T17:00:00-07:00');
// October 8, 2013 at 7:00am until Oct 10 at 5:00pm (-0700)

echo DateFormatter::format('2013-08-31T07:00:00-07:00', '2013-09-01T17:00:00-07:00');
// August 31, 2013 7:00am until September 1 at 5:00pm (-0700)

echo DateFormatter::format('2013-12-31T07:00:00-07:00', '2014-01-01T17:00:00-07:00');
// December 31, 2013 7:00am until January 1, 2014 5:00pm (-0700)

echo IndieWeb\DateFormatter::format('2013-10-08T07:00:00-0700', '2013-10-08T08:50:00-0700', 'dt-departure', 'dt-arrival');

  public function testDescriptionOfWhatYoureTesting() {
    $this->_testEquals('Final Text Output', 'start-date', 'end-date');
  }
html
<time class="dt-start" datetime="2013-10-08T07:00:00-07:00">
  October 8, 2013 from 7:00am
</time>
to
<time class="dt-end" datetime="2013-10-08T17:00:00-07:00">
  5:00pm (-0700)
</time>
html
<time class="dt-departure" datetime="2013-10-08T07:00:00-07:00">
  October 8, 2013 from 7:00am
</time>
to
<time class="dt-arrival" datetime="2013-10-08T8:50:00-07:00">
  8:50am (-0700)
</time>