by
klaus » Wed Feb 25, 2015 6:19 pm
Thanks again!! Much appreciated, as always!
Searched a bit around before, but sometimes it takes one who knows where to find the right thing.
I came up actually with a "couch" version in the meanwhile
- Code: Select all
<cms:set current_year="<cms:date format='Y'/>"/>
<cms:set current_month="<cms:date format='m'/>"/>
<cms:set current_day="<cms:date format='d'/>"/>
<cms:set start_month="<cms:sub current_month '2' />"/>
<cms:set start_day = current_day/>
<cms:if start_month le '0' >
<cms:set start_year="<cms:sub current_year '1' />"/>
<cms:set start_month="<cms:add current_month '12' />"/>
<cms:set start_month="<cms:sub start_month '2' />"/>
</cms:if>
<cms:if current_month='1'>
<cms:if current_day = '31'>
<cms:set start_day = '30'/>
</cms:if>
<cms:else_if current_month='2'>
<cms:if current_day ge '28'>
<cms:set start_day = '31'/>
</cms:if>
<cms:else_if current_month='4'>
<cms:if current_day ge '29'>
<cms:set start_day = '28'/>
</cms:if>
</cms:if>
<cms:show start_day/> <cms:show start_month/> <cms:show start_year/>
Counting 2 months backwards, the days would have to change if it would be the end of january (31st) to november (30th), the end of february (28th or 29th) to 31st of december and for april (30th) to february 28th.