Arjan Scherpenisse <[EMAIL PROTECTED]> 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.


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to