<time datetime="2012-02-29T10:06:33.9228516+00:00" pubdate>29 February 2012</time>
I'm now trying to figure out a way to remove the unnecessary digits from the time string and have it output the date published rather than the current date!
In addition, this code seems to work within a .cshtml Scripting File, but not within a page template. Does it need to be formatted slightly differently for this?
Output correct "datetime" <time> attribute
I'm looking to output a timestamp of when content was published within Umbraco, in the correct format required by the HTML5 <time> element.
For example:
<time datetime="2012-02-28T20:00+00:00" pubdate>February 28, 2012</time>
Is there a way to achieve this with Razor? I know with PHP there's a particular "W3C" way of outputting timestamps (http://goo.gl/sEFsh).
More info on correct formatting of this <time> element can be found here: http://html5doctor.com/the-time-element/
Hi. I think you could just use usual DateTime.ToString(formatString) with format string "yyyy-MM-ddThh:mm+zzzz". Like:
Thanks for your response!
Unfortunately that doesn't work for me, although this does:
That gives me this output:
I'm now trying to figure out a way to remove the unnecessary digits from the time string and have it output the date published rather than the current date!
In addition, this code seems to work within a .cshtml Scripting File, but not within a page template. Does it need to be formatted slightly differently for this?
is working on a reply...