note 27509 modified in function.getdate by vincent

From: Date: Thu, 14 Aug 2003 08:42:08 +0000
Subject: note 27509 modified in function.getdate by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54139@lists.php.net to get a copy of this message
Yup, it does so the getdate gives you the wrong daynumber. using the following modification will give you the exact weeknr: function week_of_year($nDay,$nMonth,$nYear) { $date=getDate(mktime(9,0,0,$nMonth,$nDay,$nYear)); $weeknr=floor(($date["yday"]+1)/7)+1; $weeknr %=52; return $weeknr; } --was-- Yup, it does so the getdate gives you the wrong daynumber. using the following modification will give you the exact weeknr: function week_of_year($nDay,$nMonth,$nYear) { $date=getDate(mktime(9,0,0,$nMonth,$nDay,$nYear)); $weeknr=floor(($date["yday']+1)/7)+1; $weeknr %=52; return $weeknr; } http://www.php.net/manual/en/function.getdate.php

« previous php.notes (#54139) next »