• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Display current date/time in xsl

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't any function in XSLT 1.0 to produce the current timestamp.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This solution worked out for me. It might help you:

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting the solution Dmitrij Beloborodov. It helped me resolve my problem too!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!