calculating the weeknumber

Is there a function to calculate the weeknumber ?

like:
[code]
echo date("d");
[/code]
displays the day of the month, etc.

If not, how can I calculate it myself, in other words what are the rules? Is week 1 the week in wich januari 1st is to be found.



;-)
-mac-
mailto:programmersheaven@mac-doggie.nl
the Netherlands...

Comments

  • Hi,

    Try this:

    <?php

    echo date("W");

    // this only work by php 4.1 or better

    // note: by linux the week starts on 0
    // and on windows the week start on 1

    ?>

    : Is there a function to calculate the weeknumber ?
    :
    : like:
    : [code]
    : echo date("d");
    : [/code]
    : displays the day of the month, etc.
    :
    : If not, how can I calculate it myself, in other words what are the rules? Is week 1 the week in wich januari 1st is to be found.
    :
    :
    :
    : ;-)
    : -mac-
    : mailto:programmersheaven@mac-doggie.nl
    : the Netherlands...
    :
    :

  • : Is there a function to calculate the weeknumber ?
    :
    : like:
    : [code]
    : echo date("d");
    : [/code]
    : displays the day of the month, etc.
    :
    : If not, how can I calculate it myself, in other words what are the rules? Is week 1 the week in wich januari 1st is to be found.

    Look up www.php.net/date it has all the parameters possible for the date() function


  • : : Is there a function to calculate the weeknumber ?
    : :
    : : like:
    : : [code]
    : : echo date("d");
    : : [/code]
    : : displays the day of the month, etc.
    : :
    : : If not, how can I calculate it myself, in other words what are the rules? Is week 1 the week in wich januari 1st is to be found.
    :
    : Look up www.php.net/date it has all the parameters possible for the date() function
    :
    :
    :


    Hi,

    Yes, there is a function for calculating the weeknumber, but is does only work in php 4.1 or beter.

    Isn't a user function for it?

    Alex
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories