Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm implementing news functionality for a website.
In my xslt file, the date is accessed like this:
<td class="date"><xsl:value-of select="newsDate"/></td>
This works great but the date rendered on the page is a full date with time part, like this:
2011-01-10T00:00:00
I don't need the time part. Does someone know how I can read out the date without the time part, like this:
2011-01-10
Thanks for your help,
Anthony CandaeleBelgium
Comment author was deleted
Hi Anthony
You'll need to use an umbraco.library function called FormatDateTime
Example
umbraco.library:FormatDateTim($currentPage/@createdate,'dddd dd MMMM yyyy')
umbraco.library:FormatDateTime($currentPage/@createdate,'dddd dd MMMM yyyy') that is
Hi Anthony.
You can try out this:
<xsl:value-of select="umbraco.library:FormatDateTime(newsDate,'yyyy-MM-dd')"/>
/Kim A
Thanks Tim and Kim, I should have a little more confidence in myself, I tried out an Umbraco library function and solved it like this:
<td class="date"><xsl:value-of select="Exslt.ExsltDatesAndTimes:date(newsDate)"/></td>
this gives the following result:
But maybe this format is better:
10/01/2011
so I'll use this Umbraco library function suggested by Kim:
<xsl:value-of select="umbraco.library:FormatDateTime(newsDate,'dd-mm-yyyy')"/>
hmmm, curious result, I get:
10-00-2010
:)
ok, should have been:
<xsl:value-of select="umbraco.library:FormatDateTime(newsDate,'dd-MM-yyyy')"/>
Thanks Kim and Tim for helping me out!
Anthony
No problemo Anthony.
If you want to know more about formatting dates using the FormatDateTime extension, I'd suggest that you read this wiki. There are some good examples, and explanations of how you can achieve the result you want.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
how to formate date with xslt
Hi,
I'm implementing news functionality for a website.
In my xslt file, the date is accessed like this:
<td class="date"><xsl:value-of select="newsDate"/></td>
This works great but the date rendered on the page is a full date with time part, like this:
2011-01-10T00:00:00
I don't need the time part. Does someone know how I can read out the date without the time part, like this:
2011-01-10
Thanks for your help,
Anthony Candaele
Belgium
Comment author was deleted
Hi Anthony
You'll need to use an umbraco.library function called FormatDateTime
Example
umbraco.library:FormatDateTim($currentPage/@createdate,'dddd dd MMMM yyyy')
Comment author was deleted
umbraco.library:FormatDateTime($currentPage/@createdate,'dddd dd MMMM yyyy') that is
Hi Anthony.
You can try out this:
/Kim A
Thanks Tim and Kim, I should have a little more confidence in myself, I tried out an Umbraco library function and solved it like this:
<td class="date"><xsl:value-of select="Exslt.ExsltDatesAndTimes:date(newsDate)"/></td>
this gives the following result:
2011-01-10
But maybe this format is better:
10/01/2011
so I'll use this Umbraco library function suggested by Kim:
hmmm, curious result, I get:
10-00-2010
:)
ok, should have been:
Thanks Kim and Tim for helping me out!
Anthony
No problemo Anthony.
If you want to know more about formatting dates using the FormatDateTime extension, I'd suggest that you read this wiki. There are some good examples, and explanations of how you can achieve the result you want.
/Kim A
is working on a reply...