login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Na aanleiding van IRC FUN

Offline Bart - 21/12/2007 13:53 (laatste wijziging 21/12/2007 13:55)
Avatar van BartPHP expert Oke, ik post dit topic even na aanleiding van wat er gezegd werd op het IRC kanaal.
Citaat:
[13:47] <@Marten> mij krijg je niet kwaad
[13:47] <Giant> stijn?
[13:47] <+Quicky> jawel 
[13:47] <@Marten> niet
[13:47] <Gunirus> Marten: wedden,
[13:47] <Gunirus> 
[13:47] * @stijn is aan het eten
[13:47] <+Quicky> Marten wedde dat ik jou zo kwaad heb
[13:47] <@Marten> try it
[13:47] <+Quicky> nee dankje, k wil geen ban op sima
[13:47] <+Quicky> (A)
[13:47] <@Marten> ik beloof je niet te bannen
[13:47] <+Quicky> ja daag 
[13:47] <Giant> stijn, di bug op plaatscode, wanneer ga je die eens oplossen?
[13:47] <+Quicky> straks ziet een andere admin het en ben ik de lul
[13:48] <Giant> doet het dan via pm:P
[13:48] <+Quicky> nee dan is de lol eraf
[13:48] <Gunirus> Marten: hij vertrouwt je niet
[13:48] <@stijn> STRAKS
[13:48] <Gunirus> ik zou hem bannen
[13:48] <@stijn> ik ben aan het eten + southpark aan het zien
[13:48] <Giant> 
[13:48] <+Quicky> Gunirus loop niet te stoke jij
[13:48] <@Marten> maar ik zal niks terug doen en andere admins ook niet 

Citaat:
[13:50] <@Marten> onthoud ik zal je nooit bannen op sima voor dit he ;)

Lees het stukje hierboven maar even aandachtig door, Marten krijg je niet kwaad. Wedde van wel? Let maar op!
Met het volgende krijg ik Marten wel kwaad 

-------------
<?php
function datediff($interval, $datefrom, $dateto, $using_timestamps = false) {
/*
$interval can be:
yyyy - Number of full years
q - Number of full quarters
m - Number of full months
y - Difference between day numbers
(eg 1st Jan 2004 is "1", the first day. 2nd Feb 2003 is "33". The datediff is "-32".)
d - Number of full days
w - Number of full weekdays
ww - Number of full weeks
h - Number of full hours
n - Number of full minutes
s - Number of full seconds (default)
*/

if (!$using_timestamps) {
$datefrom = strtotime($datefrom, 0);
$dateto = strtotime($dateto, 0);
}
$difference = $dateto - $datefrom; // Difference in seconds

switch($interval) {

case 'yyyy': // Number of full years

$years_difference = floor($difference / 31536000);
if (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom), date("j", $datefrom), date("Y", $datefrom)+$years_difference) > $dateto) {
$years_difference--;
}
if (mktime(date("H", $dateto), date("i", $dateto), date("s", $dateto), date("n", $dateto), date("j", $dateto), date("Y", $dateto)-($years_difference+1)) > $datefrom) {
$years_difference++;
}
$datediff = $years_difference;
break;

case "q": // Number of full quarters

$quarters_difference = floor($difference / 8035200);
while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($quarters_difference*3), date("j", $dateto), date("Y", $datefrom)) < $dateto) {
$months_difference++;
}
$quarters_difference--;
$datediff = $quarters_difference;
break;

case "m": // Number of full months

$months_difference = floor($difference / 2678400);
while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom)+($months_difference), date("j", $dateto), date("Y", $datefrom)) < $dateto) {
$months_difference++;
}
$months_difference--;
$datediff = $months_difference;
break;

case 'y': // Difference between day numbers

$datediff = date("z", $dateto) - date("z", $datefrom);
break;

case "d": // Number of full days

$datediff = floor($difference / 86400);
break;

case "w": // Number of full weekdays

$days_difference = floor($difference / 86400);
$weeks_difference = floor($days_difference / 7); // Complete weeks
$first_day = date("w", $datefrom);
$days_remainder = floor($days_difference % 7);
$odd_days = $first_day + $days_remainder; // Do we have a Saturday or Sunday in the remainder?
if ($odd_days > 7) { // Sunday
$days_remainder--;
}
if ($odd_days > 6) { // Saturday
$days_remainder--;
}
$datediff = ($weeks_difference * 5) + $days_remainder;
break;

case "ww": // Number of full weeks

$datediff = floor($difference / 604800);
break;

case "h": // Number of full hours

$datediff = floor($difference / 3600);
break;

case "n": // Number of full minutes

$datediff = floor($difference / 60);
break;

default: // Number of full seconds (default)

$datediff = $difference;
break;
}

return $datediff;
}
?>

0 antwoorden

Gesponsorde links
Er zijn nog geen reacties op dit bericht.
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2020 Sitemasters.be - Regels - Laadtijd: 0.711s