Skip to content

Instantly share code, notes, and snippets.

@styks1111
Last active January 23, 2018 18:53
Show Gist options
  • Select an option

  • Save styks1111/f777ce5cacd2e588efeb6a8d958c26e2 to your computer and use it in GitHub Desktop.

Select an option

Save styks1111/f777ce5cacd2e588efeb6a8d958c26e2 to your computer and use it in GitHub Desktop.

Revisions

  1. styks1111 revised this gist Jan 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion select_options.php
    Original file line number Diff line number Diff line change
    @@ -9,5 +9,5 @@

    $options = [];
    foreach($months as $month){
    $options = $month->format('F Y');
    $options[] = $month->format('F Y');
    }
  2. styks1111 revised this gist Jan 23, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions select_options.php
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@

    $start = new \DateTime();
    $end = clone($start);
    $end->add(new \DateInterval('P3M'));

    $interval = new \DateInterval('P1M');
    $months = new \DatePeriod($start, $end, $interval);
  3. styks1111 created this gist Jan 23, 2018.
    12 changes: 12 additions & 0 deletions select_options.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php

    $start = new \DateTime();
    $end = clone($start);

    $interval = new \DateInterval('P1M');
    $months = new \DatePeriod($start, $end, $interval);

    $options = [];
    foreach($months as $month){
    $options = $month->format('F Y');
    }