treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] How to use the HTML time element in blog post?

  • Hi all

    I am developing a blog post and wish to wrap the date the blog was published around a 'time' tag. The code would look like this....

    <time datetime="2013-01-28">
        28.01.2013
    </time>
    

    However, how does the datetime attribute get updated to show the correct date? The date itself would be dynamically created via wordpress. Do I simply put the same code that generates the date into the attribute tag?

  • I think you'd probably end up using something like this:

      <time datetime=<?php the_time('Y-m-d') ?>>
         <?php the_time('Y.m.d') ?>
      </time>
    
  • Thanks, that is what I was thinking. It seems the most logical solution