Title: Put current date into url
Last modified: August 20, 2016

---

# Put current date into url

 *  [dml3001](https://wordpress.org/support/users/dml3001/)
 * (@dml3001)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/put-current-date-into-url/)
 * I would like to place this function:
 * `<?php the_date('Y/m/d/') ?>;`
 * at the end of my a href url. Unfortunately, nothing has been working for me. 
   I have tried directly placing it like this:
 * `<a href="www.mysite.com/<?php the_date('Y/m/d/') ?>;>`
 * I have also tried doing this:
 * `$date = <?php the_date('Y/m/d/') ?>;`
    `<a href="www.mysite.com/$date">`
 * and this:
 * `$date = <?php the_date('Y/m/d/') ?>;`
    `<a href="www.mysite.com/' . urlencode(
   $date) . '">`
 * Any help would be much appreciated. I’ve looked EVERYWHERE on the web for this
   with no luck.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/put-current-date-into-url/#post-2679672)
 * > I’ve looked EVERYWHERE on the web for this with no luck.
 * have you read the codex chapter of `the_date()` ?
 * [http://codex.wordpress.org/Function_Reference/the_date](http://codex.wordpress.org/Function_Reference/the_date)
 * or did you try to use:
 * [http://php.net/manual/en/function.date.php](http://php.net/manual/en/function.date.php)
 *  Thread Starter [dml3001](https://wordpress.org/support/users/dml3001/)
 * (@dml3001)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/put-current-date-into-url/#post-2679684)
 * Well, I’ve read the codex chapter of `the_date()`, but that second link seems
   interesting.
 * I am still unsure though as to how I could use `string date ( string $format [,
   int $timestamp = time() ] )` in my a href url.
 * I essentially want to know how to put a date at the end of `<a href="www.mysite.
   com/putthedatehere">`
 * Thanks for the response.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Put current date into url’ is closed to new replies.

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [dml3001](https://wordpress.org/support/users/dml3001/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/put-current-date-into-url/#post-2679684)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
