Arvind Raj
Arvind Raj

Reputation: 17

Displaying current datetime value in xsl

We are trying to display the current datetime value in XSL report along with the meridian and the timezone. I am able to achieve the same using the below tag except for the meridian. Please advice.

date:format-date(date:date-time(), 'dd/MM/yyyy hh:mm:ss Z')

Tried below, but the tt is for Microsoft date format and it is coming the same in the report and I m not able to get the expected AM or PM

date:format-date(date:date-time(), 'dd/MM/yyyy hh:mm:ss tt Z')

Upvotes: 0

Views: 715

Answers (3)

bjimba
bjimba

Reputation: 928

Looks like EXSLT to me as well, in which case Michael is correct with the suggestion to use "a" to get AM/PM. If your declaration of the "date" namespace is:

xmlns:date="http://exslt.org/dates-and-times"

then that's what you're using. Implementations of EXSLT dates-and-times are supposed to support the Java JDK 1.1 SimpleDateFormat, so you can use this page as a reference. You will probably also want to refer to the exslt.org page.

Upvotes: 0

michael.hor257k
michael.hor257k

Reputation: 116982

Since you are obviously not using XSLT 2.0, but some sort of an extension to XSLT 1.0 (perhaps EXSLT?), try:

date:format-date(date:date-time(), 'dd/MM/yyyy hh:mm:ss a Z')

Upvotes: 1

tgo
tgo

Reputation: 1545

If you are using XSLT 2.0, try

dd/MM/yyyy hh:mm:ssP Z

Full doc can be found here

Upvotes: 0

Related Questions