Skip to content

Instantly share code, notes, and snippets.

@nullproduction
Created May 4, 2015 07:23
Show Gist options
  • Save nullproduction/3c9a87c4ba71d6eda43f to your computer and use it in GitHub Desktop.
Save nullproduction/3c9a87c4ba71d6eda43f to your computer and use it in GitHub Desktop.

Revisions

  1. nullproduction renamed this gist May 4, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. nullproduction created this gist May 4, 2015.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <?php namespace App\Libs\Helper;

    use Jenssegers\Date\Date;

    class Helper {

    /**
    * Get Date
    */
    public static function getDate($date)
    {
    $twoDaysSeconds = 60 * 60 * 24 * 2;
    $seconds = time() - Date::parse($date)->timestamp;
    if ($seconds == 0) return 'Сейчас';
    return ($seconds < $twoDaysSeconds) ?
    Date::parse($date)->ago() :
    Date::parse($date)->format("j M в H:i");
    }

    }