<p>Craft 3 removed the extended DateTime class, so <code>{postDate.year}</code> doesn't work with Craft 3. It must be formatted as <code>{postDate|date('Y')}</code> in the Entry URI format field.</p>

CC BY-SA 4.0
2018-08-14T16:48:36.000Z
2018-08-14T22:50:31.400Z
2018-08-14T22:50:31.400Z
user3092
<p>I have a News channel that's looped on an 'News Index' template. Each news entry is linked to its respective link via <code>{{ entry.url }}</code>. In my News channel settings, I have the entry URI format to be <code>news/{postDate.year}/{slug}</code>. However, the <code>{{ entry.url }}</code> link goes to <code>news/{slug}</code>. I assumed that if you set the URI format in the channel settings, it would create entry URLs based on the specified URI format. But that doesn't seem to be working. Can someone let me know where I'm going awry?</p>

CC BY-SA 4.0
2018-08-14T07:42:39.017Z
Please take a look at your sidebar, are there any running tasks? When you change the Uri format in your section, all entries must be saved again. If this task is unable to run, your url won't change
Robin Schambach
CC BY-SA 4.0
2018-08-14T13:50:51.067Z
@RobinSchambach I saved the entries again, but that didn't change the URI format. I also emptied the cache, just in case. Not sure if this affects the matter at hand, but my site is localized with two languages, English and Korean. The Entry URI format are both "news/{postDate.year}/{slug}" and "Propagate entries across all enabled sites?" is selected. Also, what should I be looking for on the sidebar? I'm not sure how to tell if there's a task running.
user3092
CC BY-SA 4.0
2018-08-14T15:09:01.693Z
There is a little hint below the last list item in your sidebar that states tasks. You may insert the code above in your title field and store an entry again in order to see the result since your title field behaves as a template as well.  At least your code works for me
Robin Schambach
CC BY-SA 4.0
2018-08-14T16:46:44.880Z
@RobinSchambach Figured it out. Craft 3 removed the extended DateTime class, so {postDate.year} doesn't work with Craft 3. It must be formatted as {postDate|date('Y')}.
user3092
<craft3><channels>
Entry URI format with postDate not working
# Entry URI format with postDate not working

(Asked by: username_0 on 2018-08-14)

I have a News channel that's looped on an 'News Index' template. Each news entry is linked to its respective link via `{{ entry.url }}`. In my News channel settings, I have the entry URI format to be `news/{postDate.year}/{slug}`. However, the `{{ entry.url }}` link goes to `news/{slug}`. I assumed that if you set the URI format in the channel settings, it would create entry URLs based on the specified URI format. But that doesn't seem to be working. Can someone let me know where I'm going awry?

**Tags:** craft3, channels

> **Comments:**
> **username_1**: Please take a look at your sidebar, are there any running tasks? When you change the Uri format in your section, all entries must be saved again. If this task is unable to run, your url won't change  
> **username_0**: @RobinSchambach I saved the entries again, but that didn't change the URI format. I also emptied the cache, just in case. Not sure if this affects the matter at hand, but my site is localized with two languages, English and Korean. The Entry URI format are both "news/{postDate.year}/{slug}" and "Propagate entries across all enabled sites?" is selected. Also, what should I be looking for on the sidebar? I'm not sure how to tell if there's a task running.  
> **username_1**: There is a little hint below the last list item in your sidebar that states tasks. You may insert the code above in your title field and store an entry again in order to see the result since your title field behaves as a template as well.  At least your code works for me  
> **username_0**: @RobinSchambach Figured it out. Craft 3 removed the extended DateTime class, so {postDate.year} doesn't work with Craft 3. It must be formatted as {postDate|date('Y')}.  

---

## 1 answers

### Answer by username_0 on 2018-08-14. Score: 1

Craft 3 removed the extended DateTime class, so `{postDate.year}` doesn't work with Craft 3. It must be formatted as `{postDate|date('Y')}` in the Entry URI format field.


---

