Results 1 to 3 of 3

Thread: how can i display all the weeks

  1. #1
    Join Date
    Feb 2010
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default how can i display all the weeks

    hi

    i need a code to display the week no`s with dates as seen below for the present year..

    week1 (01-07)
    week2(08-15)
    ...week52or53(25-31)...

    thanks in advance

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Not exactly sure I follow what it is you want, but here are 2 tries:

    PHP Code:
    <?php
    echo "Week ";
    echo 
    date("W");
    echo 
    " Day ";
    echo 
    date("N");
    ?>

    <br><br>
    <?PHP

    function week_day($month$year$current_day$week_day_number=1){

        
    $loop_start $current_day-(date('N'mktime(000$month$current_day$year))-1);//lets start loop from first day of week
        
    $loop_end $current_day+(7-(date('N'mktime(000$month$current_day$year))));//lets end loop to last day of week

        
    for($i $loop_start$i<=$loop_end$i++){

            
    $day_of_the_week date('N'mktime(000$month$i$year));//current day number 1-7 of week
            
    $loop_date date('d'mktime(000$month$i$year));//current day in calendar
            
    if($day_of_the_week == $week_day_number){//if weekday number equals day number then lets return date

                
    return $loop_date;
            }
        }
    }

    echo 
    week_day(82009301);//returns (24).08.2009
    echo '<br>';
    echo 
    week_day(82009305);//returns (28).08.2009

    ?>
    The firs gets the current week # and the current day of that week ( 1 - 7 )

    The second part returns a numerical value for the given date. Examples shown return "24" and "28" respectively.

    Perhaps you can draw off of these to get precisely what you want.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Feb 2010
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    sorry i have tried this but it does not reach my requirement

    can u suggest any other.............

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •