Created
May 4, 2015 07:23
-
-
Save nullproduction/3c9a87c4ba71d6eda43f to your computer and use it in GitHub Desktop.
Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment