note 43058 deleted from function.date by kennyt

From: Date: Sun, 18 Jul 2004 17:19:36 +0000
Subject: note 43058 deleted from function.date by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73499@lists.php.net to get a copy of this message
Note Submitter: riviere_gh@yahoo.fr ---- If you are using the W format character (ISO-8601 week number of year) and the Y format character, the week may loop back to 1 in late December(and there are other problems i think!): <? $endofyear = mktime(0, 0, 0, 12, 30, 2003); echo(date("Y-W\n", $endofyear)); ?> will return 2003-1. I want to use strftime's %G and %V specifiers as say : chris-php at bolt dot cx But it don't work with me?? So I make a small function that return the number of week with a date in input : function dateToSemaine($date){ $annee=date('Y',$date); $datePremier="1/1/$annee"; $datePremier=strtotime($datePremier); $joursNum=date('w',$datePremier)-2; $nbJour=date('z',$date); $semaine=intval(($nbJour+$joursNum)/7); return $semaine+1; } If you want to test it. You can say me what you think about so. Thanks.

« previous php.notes (#73499) next »