PHP code example of phx2600 / firstfriday

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

    

phx2600 / firstfriday example snippets


use PHX2600/FirstFriday;

$firstFriday = new FirstFriday($timezone);

$nextFirstFriday = $firstFriday->next();

$previousFirstFriday = $firstfriday->previous();

$nextFirstFriday->toDateString();           // 1975-12-25
$nextFirstFriday->toFormattedDateString();  // Dec 25, 1975
$nextFirstFriday->toDateTimeString();       // 1975-12-25 14:15:16
$nextFirstFriday->toDayDateTimeString();    // Thu, Dec 25, 1975 2:15 PM

$nextFirstFriday->format('l jS \\of F Y h:i:s A');  // Thursday 25th of December 1975 02:15:16 PM

$nextFirstFriday->diffForHumans();  // Something like '1 week from now' or '1 month from now'

// The following return boolean true or false
$firstFriday->isToday();
$firstFriday->isYesterday();
$firstFriday->isTomorrow();
$firstFriday->isFuture();
$firstFriday->isPast();

$today = Carbon::create(2017, 7, 1, 0, 0, 0, 'America/Phoenix');
$firstFriday = new FirstFriday('America/Phoenix', $today);

$firstFriday = new FirstFriday('America/Phoenix');
$today = Carbon::create(2017, 7, 1, 0, 0, 0, 'America/Phoenix');

$firstFriday->overrideToday($today)->next();