| Author |
Display current date/time in xsl
|
JayaSiji Gopal
Ranch Hand
Joined: Sep 27, 2004
Posts: 303
|
|
I have an xml document which uses xsl for transformation to excel. in the xsl document, i need to also write code to display the current date/time in the format - {$DD-Mmm-YYYY 24HH:MN:SS TZN}" timestamp unwrapped. TZN is user's time zone. I actually get the idea to use xs:datetime, however, i am unfamiliar with the usage in xsl. Could someone please help me with the syntax?
|
SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16482
|
|
|
There isn't any function in XSLT 1.0 to produce the current timestamp.
|
 |
Dmitrij Beloborodov
Greenhorn
Joined: Mar 09, 2010
Posts: 2
|
|
For XSLT 2.0 you have a wealth of date functions, i.e.:
as well as current-date() and current-time().
For XSLT 1 you'll have to use the dates-and-times EXSLT extension package. Here's a usage example for XSLT 1:
The only problem is get date in specific format.
|
 |
Dmitrij Beloborodov
Greenhorn
Joined: Mar 09, 2010
Posts: 2
|
|
This solution worked out for me. It might help you:
|
 |
smee bond
Ranch Hand
Joined: Sep 29, 2007
Posts: 34
|
|
|
Thanks for posting the solution Dmitrij Beloborodov. It helped me resolve my problem too!
|
 |
 |
|
|
subject: Display current date/time in xsl
|
|
|