How can i get the current time in my data view web part

I’m posting this in case anyone is looking to easily get the time from your SharePoint server through the data view webpart. This will give you the hour, minute, second in the 24 hour format
 
The same approach could be used if you needed to gather the date in day, month, year.
<span class="hour"><xsl:value-of select="substring-before(substring-after(string(ddwrt:TodayIso()),'T'),':')"></xsl:value-of> </span>  
<span class="minute"><xsl:value-of select="substring-before(substring-after(substring-after(string(ddwrt:TodayIso()),'T'),':'),':')"></xsl:value-of> </span>  
<span class="hour"><xsl:value-of select="substring-before(substring-after(substring-after(substring-after(string(ddwrt:TodayIso()),'T'),':'),':'),'Z')"></xsl:value-of></span> 
Advertisements