Trying to learn HTML5 is very frustrating because things are so poorly defined (and seem to be a moving target).
As of November 2015, is there a way to define the date and time of an article?
I was looking to do this…
<article>
<header>
<h1>Some Article Title</h1>
<??>Published On here</??>
</header>
</article>
There is the <time datetime="ccyy-mm-dd hh:mm">
tag and attribute
Look up microformats - what @felgall has posted is an example of that.
Is your article is stored in database table? If so I would also have a date field (stored as TIMESTAMP) and simply use the extensive PHP date formating facilities:
<p>
<?php echo date('l, jS F Y - H:i:s ', $dateFromTable);?>
</p>
Output:
Monday, 2nd November 2015 - 15:40:25
So w3.org has added this back into the HTML5 standard?
Yesterday I saw some people say to use pubdate but then other said it was taken out. I thought might be deprecated as well.
John_Betong:
Is your article is stored in database table? If so I would also have a date field (stored as TIMESTAMP) and simply use the extensive PHP date formating facilities:
<p>
<?php echo date('l, jS F Y - H:i:s ', $dateFromTable);?>
</p>
Output:
Monday, 2nd November 2015 - 15:40:25
Yes, articles will be stored in a database.
I am familiar with PHP’s formatting, but this question was one of HTML semantics.
Since I have been learning HTML5, I thought it might be good to add a date-time element to the header of the article element if a valid one exists.
According to CanIUse: Time , the support for is bad…
Is there a better alternative?
That was where I looked it up (since I haven’t actually needed it myself yet).
system
Closed
February 2, 2016, 1:03am
9
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.