> > > Hi all. > > > > > > I have the week number (for example, this is the 29th week of the > > > year and it begins on 7/17/05). Does anyone know how to obtain the > > > first (and maybe the last) date of the week if you only know the week > > > number of the year? Would it be better for me to obtain this in PHP > > > or MySQL? or both? i did a little coding, try this and give me any comments.. <?php $week = 7; $year = 2028; $uts = mktime(0,0,0,1,1,$year); // 604800 = 7 days in seconds $w2s = (($week-1) * 604800); //unix time stamp for the first date of the given week $suts = $uts + $w2s; echo "<pre>"; echo "Start Date: " . date("j-M-Y (l)",($suts)); echo "<br>"; //518000 = 6 days in seconds echo "Last Date: " . date("j-M-Y (l)",($suts+518400)); echo "<pre>"; ?> happy coding vk. > > > > > > I have researched the archives on a few lists and I know that others > > > have asked this same questions, but I have not found a good solution. > > > I have also looked on MySQL's "date and time functions" page, but had > > > little luck. > > > > > > Any thoughts would be appreciated. > > > ~Philip > > > > > Hi Philip > > > > give this a go... i played around with the date functions of mysql > > > > select date_sub(curdate() , interval (date_format(curdate() , '%w')-1) > > day) as firstday , date_add(curdate() , interval (7 - > > date_format(curdate() , '%w')) day) as lastday > > > > it will give you the date of the monday and the sunday of the current week > > > > hope this solves your problem. > > > > Arno > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php