Forums / Cotonti / Support / Displaying date of 1 month ago in the list?

foxhound
#1 2013-12-09 07:21

I want to display a "since" date in my lists. It should always display the date of the current day minus 31 days.
I have been trying the whole night but sadly my lack of knowledge prevents me from getting anywhere.

I am trying things like this: 

<h3>Most read news since {PAGE_ROW_DATE_STAMP|cot_date('mktime () - 30 * 3600 * 24', $this)}</h3>
<h3>Most read news since {PAGE_ROW_DATE_STAMP|cot_date("d-m-Y", UNIX_TIMESTAMP() -2629743, $this)}</h3>

 

If I just do 

<h3>Most read news since {PAGE_ROW_DATE_STAMP|cot_date("d-m-Y", $this)}</h3>

 

I get the start date of UNIX time, so I am on the right path. All I have to figure out now is how to correctly add the UNIX_TIMESTAMP () to add to that value and than extract 30 or 31 days from that.
In all those hours I only got to see that start date and otherwise it becomes a line of giberish text.

I have checked the php code manual, I also checked the Function Summary:http://www.cotonti.com/reference/cotonti/package-functions.htm but I just can not figure it out. maybe its not possible to display that date sine we do not have a good reference point? Right now PAGE_ROW_DATE_STAMP  is used but I should actually reference the default time on the server, I think?
I also tried with "{PAGE_ROW_RAW.user_sidtime}" but that too did not give me any usable results.

 

I hope anyone here has a good idea and can help me.

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
Twiebie
#2 2013-12-09 14:44

Try:

{PHP|strtotime("now -1 month")|cot_date('d-m-Y', $this)}

 

foxhound
#3 2013-12-09 20:17

Works perfectly! Thanks a lot, this can be usefull in other places too :)

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />