Skip to content

Instantly share code, notes, and snippets.

View garak's full-sized avatar
:octocat:
Working from home...

Massimiliano Arione garak

:octocat:
Working from home...
View GitHub Profile
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@henrikbjorn
henrikbjorn / RelDate.php
Created December 5, 2011 08:01 — forked from arnaud-lb/RelDate.php
4 lines relative date formatter with DateInterval and Symfony2 Translator
<?php
use Symfony\Component\Translation\TranslatorInterface;
function format(\DateTime $date, TranslatorInterface $translator)
{
$diff = date_create()->diff($date);
$seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s;
$format = $translator->transChoice('reldate', $seconds);