Answers.Body: <p>There's no build in functionality for this, but you could make a custom plugin that automatically sets the expiration date <code>expiryDate</code> when you first save an entry with a specific entry type.</p>
  
  <p>Another option would be to simply filter your entries from your template:</p>
  
  <pre><code>{% set entries = craft.entries.type('myEntryType').postDate('&gt;= ' ~ now|date_modify('-10 days')) %}
  </code></pre>
  
  <p>.</p>
  
  <p><em>Edit:</em></p>
  
  <p>Here's a description for the expression used as the value for the <a href="http://twig.sensiolabs.org/doc/filters/date_modify.html" rel="nofollow"><code>date_modify</code></a> parameter.</p>
  
  <p>Have a look at the <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax" rel="nofollow">syntax for parameter values</a> in the Craft docs. And also how the <a href="http://twig.sensiolabs.org/doc/filters/date_modify.html" rel="nofollow"><code>date_modify</code></a> filter works. <code>now|date_modify('-10 days')</code> returns a string which is then <a href="http://twig.sensiolabs.org/doc/templates.html#other-operators" rel="nofollow">concatenated</a> with the string <code>'&gt;= '</code> and then passed as a value to the <code>postDate()</code> parameter.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T13:40:04.703Z
Answers.Text: hi @carlcs. can you please give me more details on `.postDate('>= ' ~ now|date_modify('-10 days'))?`
Answers.UserDisplayName: lucassoares
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T16:00:11.173Z
Answers.Text: @lucassoares - carlcs postDate parameter is saying, make sure that he post date is greater than or equal to the timestamp of 10 days ago. It will guarantee that the entries returned are newer than 10 days old.
Answers.UserDisplayName: Wes Rice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T16:24:53.960Z
Answers.Text: @Wes This is a nice description on what happens if you apply the parameter on a ElementCriteriaModel. I altered my answer to make it easier to understand the syntax used.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T16:57:27.613Z
Answers.Text: @WesRice that would make entries to become expired after 10 days from current date or it would just have their date modified to 10 days earlier from current date?
Answers.UserDisplayName: lucassoares
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T17:02:41.140Z
Answers.Text: @lucassoares both wrong. As I tried to explain in the answer, the only way to automatically set the expiration date is with a plugin. And the code example doesn't modify your entry in the DB. It is used in your template as a filter on an ElementCriteriaModel. If you use it like so, only entries newer then 10 days from the current moment `'now'` are returned. Compare it to the parameter `section()` where only entries from select sections are returned!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T17:07:30.633Z
Answers.Text: You'd have the same output from the Twig code, but the entries are still marked as "active" (status: green) in the Control Panel.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-22T16:02:03.800Z
Answers.Text: @carlcs Awesome, that would totally work for me. Should this code be in the single entry template or index template?
Answers.UserDisplayName: lucassoares
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-22T16:16:26.350Z
Answers.Text: Hehe, if you put it in the entry template it's already to late @lucassoares ;)
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-19T12:02:04.033Z
Answers.LastActivityDate: 2014-08-19T17:04:49.627Z
Answers.LastEditDate: 2014-08-19T17:04:49.627Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>You could use my <a href="https://github.com/carlcs/craft-autoexpire" rel="nofollow">Auto Expire</a> plugin for this. Just add a new expiration rule with the expiration date set to:</p>
  
  <pre><code>{ postDate|date_modify('+14 days 5am')|date('c') }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-13T16:03:55.937Z
Answers.LastActivityDate: 2015-05-13T16:03:55.937Z
Answers.UserDisplayName: carlcs
Body: <p>Is there any way to set entries of an certain entry type to auto-expire after a certain number of days from the original post date? </p>
  
Tags: <entries><datetime><postdate>
Title: How to set entries to auto-expire after certain # of days from post date?
ThreadText: # How to set entries to auto-expire after certain # of days from post date?
  
  (Asked by: username_0 on 2014-08-19)
  
  Is there any way to set entries of an certain entry type to auto-expire after a certain number of days from the original post date?
  
  **Tags:** entries, datetime, postdate
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-08-19. Score: 5
  
  There's no build in functionality for this, but you could make a custom plugin that automatically sets the expiration date `expiryDate` when you first save an entry with a specific entry type.
  
  Another option would be to simply filter your entries from your template:
  
  ```
  {% set entries = craft.entries.type('myEntryType').postDate('>= ' ~ now|date_modify('-10 days')) %}
  
  ```
  
  .
  
  *Edit:*
  
  Here's a description for the expression used as the value for the [`date_modify`](http://twig.sensiolabs.org/doc/filters/date_modify.html) parameter.
  
  Have a look at the [syntax for parameter values](http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax) in the Craft docs. And also how the [`date_modify`](http://twig.sensiolabs.org/doc/filters/date_modify.html) filter works. `now|date_modify('-10 days')` returns a string which is then [concatenated](http://twig.sensiolabs.org/doc/templates.html#other-operators) with the string `'>= '` and then passed as a value to the `postDate()` parameter.
  
  > **Comments:**
  > **username_0**: hi @username_1. can you please give me more details on `.postDate('>= ' ~ now|date_modify('-10 days'))?`  
  > **username_2**: @username_0 - username_1 postDate parameter is saying, make sure that he post date is greater than or equal to the timestamp of 10 days ago. It will guarantee that the entries returned are newer than 10 days old.  
  > **username_1**: @Wes This is a nice description on what happens if you apply the parameter on a ElementCriteriaModel. I altered my answer to make it easier to understand the syntax used.  
  > **username_0**: @username_2 that would make entries to become expired after 10 days from current date or it would just have their date modified to 10 days earlier from current date?  
  > **username_1**: @username_0 both wrong. As I tried to explain in the answer, the only way to automatically set the expiration date is with a plugin. And the code example doesn't modify your entry in the DB. It is used in your template as a filter on an ElementCriteriaModel. If you use it like so, only entries newer then 10 days from the current moment `'now'` are returned. Compare it to the parameter `section()` where only entries from select sections are returned!  
  > **username_1**: You'd have the same output from the Twig code, but the entries are still marked as "active" (status: green) in the Control Panel.  
  > **username_0**: @username_1 Awesome, that would totally work for me. Should this code be in the single entry template or index template?  
  > **username_1**: Hehe, if you put it in the entry template it's already to late @username_0 ;)  
  
  ---
  
  ### Answer by username_1 on 2015-05-13. Score: 2
  
  You could use my [Auto Expire](https://github.com/username_1/craft-autoexpire) plugin for this. Just add a new expiration rule with the expiration date set to:
  
  ```
  { postDate|date_modify('+14 days 5am')|date('c') }
  
  ```
  
  
  ---
  
  