phpbar.de logo

Mailinglisten-Archive

[php] Kalenderwoche

[php] Kalenderwoche

Björn Schotte php_(at)_phpcenter.de
Sun, 7 Jul 2002 13:10:01 +0200


* Björn Schotte wrote:
> | Windows users cannot use the %V specifier for strftime as it is not
> | implemented in the OS. 

Weiter unten:

With this function you can get the iso weeknumber on windows systems. The
ISOWeek function by martijnc is wrong in some cases (try to calculate the
week number of 30. december 2002)

   function isoweek($datum)
   {
      $jahr=uget($datum,"year");

      $a = floor((uget($datum,"yday")+((uget(mktime
(0,0,0,1,1,$jahr),"wday")+2)%7)-3)/7)+1;
      if ($a==0)
      {
         $a = isoweek(mktime (0, 0, 0, 12, 31, $jahr-1));
      }
      else if (($a==53) && ((uget(mktime (0, 0, 0, 12, 31,
$jahr),"wday")-1)%7)<= 3)
      {
         $a = 1;
      }
      return $a;
   }

   function uget($udate,$type)
   {
      $da=getdate($udate);
      return $da[$type];
   }


-- 
Verbindlicher, professioneller PHP Support: wir helfen Ihnen
wenn es brennt, schnell und unkompliziert.

Weitere Informationen & Preise: team_(at)_thinkphp.de * 0700-THINKPHP


php::bar PHP Wiki   -   Listenarchive