<p>You're close! For the month part you need <code>postDate|date("m")</code> (<a href="http://php.net/manual/en/function.date.php">this page</a> has the php date formats).</p>

<pre><code>news/{postDate|date("Y")}/{postDate|date("m")}/{slug}
</code></pre>

CC BY-SA 3.0
2015-06-13T06:22:57.613Z
Correct me if I'm wrong, but wouldn't this also work? `news/{postDate|date("Y/m")}/{slug}`  ... You'd put the slash inside the date format, so it won't have to parse `postDate` twice.
Lindsey D
CC BY-SA 3.0
2015-06-13T15:06:58.610Z
Thanks Marion, that worked great. Lindsey's suggestion worked too, thanks.
Stephen
CC BY-SA 3.0
2015-06-13T21:59:56.103Z
@Lindsey Hadn't thought of that, but nice improvement.
Marion Newlevant
CC BY-SA 3.0
2015-06-13T03:45:21.783Z
2015-06-13T03:45:21.783Z
Marion Newlevant
<p>I'd like to make the Entry URL format of a channel look like this: /news/2015/06/my-slug-here</p>

<p>What would I need to enter into the Entry URL Format field in order to do this?</p>

<p>The closest I could manage was this:</p>

<pre><code>news/{postDate|date("Y")}/{slug}
</code></pre>

<p>But that only outputs this: /news/2015/my-slug-here</p>

<p>Thanks for any help.</p>

<url><entry><slug>
How to add year and month to Entry URL Format
# How to add year and month to Entry URL Format

(Asked by: username_0 on 2015-06-13)

I'd like to make the Entry URL format of a channel look like this: /news/2015/06/my-slug-here
What would I need to enter into the Entry URL Format field in order to do this?
The closest I could manage was this:
news/{postDate|date("Y")}/{slug}

But that only outputs this: /news/2015/my-slug-here
Thanks for any help.

**Tags:** url, entry, slug


---

## 1 answers

### Answer by username_1 on 2015-06-13. Score: 9 | Accepted answer

You're close! For the month part you need postDate|date("m") (this page has the php date formats).
news/{postDate|date("Y")}/{postDate|date("m")}/{slug}

> **Comments:**
> **username_2**: Correct me if I'm wrong, but wouldn't this also work? `news/{postDate|date("Y/m")}/{slug}`  ... You'd put the slash inside the date format, so it won't have to parse `postDate` twice.  
> **username_0**: Thanks Marion, that worked great. Lindsey's suggestion worked too, thanks.  
> **username_1**: @Lindsey Hadn't thought of that, but nice improvement.  

---

