[Zope] Re: Retrieving the week number with DateTime
Darran Edmundson
Darran.Edmundson@anu.edu.au
Wed, 2 Aug 2000 22:57:26 +1000
Arjan Scherpenisse <acscherp@wins.uva.nl> wrote:
>i want to retrieve the number of the week from a DateTime object. Is
>there any way to do this? I've looked through DateTime.py but i
>couldnt find anything usefull, is there some algorithm to get this?
You can clean it up and condense but the following should work ...
<dtml-let today="_.DateTime()">
<dtml-let cur_year="today.year()">
<dtml-let start_of_year="_.DateTime('01/01/'+_.str(cur_year))">
<dtml-let num_days="today-start_of_year">
<dtml-let week_number="_.int(num_days/7)">
<dtml-var week_number>
</dtml-let>
</dtml-let>
</dtml-let>
</dtml-let>
</dtml-let>
Cheers,
Darran.