note 43058 added to function.date

From: Date: Tue, 08 Jun 2004 12:42:23 +0000
Subject: note 43058 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-70527@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43058 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43058&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43058&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#70527) next »