1 dag geleden script

Gestart doorOne2xs8 reacties15 weergaven

9 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Weet er iemand waar ik zon scriptje vind dat datums mooi worden getoond zoals 5 jaar geleden, 2 dagen geleden, ..
Ik heb op Google gezocht maar ik vind niks
0
Berichten
1.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hoe bedoel je presies??
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hij bedoelt. zien wanneer er bv gepost is in dagen.
bv mijn post is 8dagen geleden gepost.
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rohimma schreef:
hoe bedoel je presies??
Dat als er gisteren iets is gepost ofzo.. Dat er dan staat "Gisteren Gespost" ofzo yummieEn als het 5 jaar geleden is gepost "5 jaar geleden Gepost" biggrin
Edit: Jvdw cry
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat bedoelde ik dus. emo//Sorry niet naar de post uur gekeken.
0
Berichten
7.757
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zoals facebook .. Dat is opzich niet zo moeilijk..
0
Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]function[/COLOR] ago[COLOR= #007700]([/COLOR][COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]=-[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700])
    {[/COLOR]  
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR] [URL="http://www.php.net/return"]return[/URL] [COLOR= #DD0000]"Onbekend"[/COLOR][COLOR= #007700]; }[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]==-[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$dateto[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700](); }[/COLOR]
      
        [COLOR= #0000BB]$datefrom[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$difference[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$dateto[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700];[/COLOR]

  
        [URL="http://www.php.net/switch"]switch[/URL][COLOR= #007700]([/COLOR]true[COLOR= #007700])
        {
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 min[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$difference[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] seconde geleden[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] secondes geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 hour[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$difference[/COLOR] / [COLOR= #0000BB]60[/COLOR][COLOR= #007700]);[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] minuut geleden[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] minuten geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 day[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$difference[/COLOR] / [COLOR= #0000BB]60[/COLOR] / [COLOR= #0000BB]60[/COLOR][COLOR= #007700]);[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] uur geleden[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] uren geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];        
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 week[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$day_difference[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$day_difference[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] day[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700])
                {[/COLOR]
                    [COLOR= #0000BB]$day_difference[/COLOR][COLOR= #007700]++;
                }[/COLOR]
              
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$day_difference[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #DD0000]Gisteren[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] dagen geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 month[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$week_difference[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$week_difference[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] week[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700])
                {[/COLOR]
                    [COLOR= #0000BB]$week_difference[/COLOR][COLOR= #007700]++;
                }[/COLOR]
              
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$week_difference[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #DD0000]laatste week[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] weken geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];          
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 year[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$months_difference[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$months_difference[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] month[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700])
                {[/COLOR]
                    [COLOR= #0000BB]$months_difference[/COLOR][COLOR= #007700]++;
                }[/COLOR]
              
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$months_difference[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] maand geleden[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] maanden geleden[/COLOR][COLOR= #007700];[/COLOR]

                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
            case([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-1 year[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700]):[/COLOR]
                [COLOR= #0000BB]$year_difference[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$year_difference[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] year[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$dateto[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]$datefrom[/COLOR][COLOR= #007700])
                {[/COLOR]
                    [COLOR= #0000BB]$year_difference[/COLOR][COLOR= #007700]++;
                }[/COLOR]
              
                [COLOR= #0000BB]$datediff[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$year_difference[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] jaar geleden[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$datediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] jaar geleden[/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
              
        }[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$res[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] ago[COLOR= #007700]([/COLOR]datum en tijd[COLOR= #007700]);[/COLOR]
?>
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Thanks
slotje graag yummie
0
Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Graag gedaan. Er is allee een probleem. Volgendsmij doet hij steeds 1 teveel.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren