Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

I Want to get current datetime in XSLT 1.0. By Googling, I found a method 'current-dateTime()', but its in XSLT 2.0 and also doesn't supported by Dotnet 2.0

Current requirement doesn't allow me to call any external C# method.

Is any alternate method or process or logic I can apply?

Please help me.

Thanks in Advance.


Thanks,
Siddharth
Posted
Updated 30-May-11 18:37pm
v2

1 solution

It seems that XSLT 1.0 does not provide standard any to get the current date/time. You need to use an extension function.

Use the following script
<ms:script language="javascript" implements-prefix="user">
    function datediff(date1, date2)
    {
        return Math.round(((new Date(date2)) - (new Date(date1))/1000/60);
    }
</ms:script>


Reference:

How to get the current date in xslt, and minus this from another date?[^]

<msxsl:script> Element
[^]

How To Get DateTime In XSLT[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900