OracleBIBlog Search

Wednesday, November 18, 2009

BI Publisher's Timestamp and Date

Let us take the following case: When we run a report, how do we get the correct local’s (server’s) timestamp printed?

In the process of getting the final output, every rtf template goes into different temporary files:

RTF --> XSL-FO --> FO --> HTML, PDF, XLS, RTF, etc.

When the template RTF file is converted into XSL-FO BI Publisher’s parsers include several default parameters at run time and one of them is :


<xsl:param name="_XDOTIMEZONE">GMT</xsl:param>



By default, this parameter will determine the timestamp based on Greenwich Median Time.

One way we can adjust this value in our RTF template is in the following way:

<?format-date:xdoxslt:sysdate_as_xsdformat();'Dy DD-Mon-YYYY hh24:mi:ss';'PST'?>

Where:
sysdate_as_xsdformat() : This function will generate the server’s timestamp
format-date:xdoxslt: This function will format the time & date value using the mask and the Timezone provided.

The output obtained is similar to:

Thu 19-Nov-2009 21:47:50

When the server is located in New York (EST) then its timestamp is like: Fri 20 Nov 2009, 00:47:50.

As indicated above if the timezone is omitted (i.e PST, EST, etc) then GMT will be used and the output would have been:

Fri 20-Nov-2009 05:47:50

You can find a good example on formatting date values in this link:

http://www.oracle.com/technology/products/xml-publisher/demoshelf/viewlets/TemplateBuilder-FormatDates.html

And the corresponding documentation on date formatting here:

http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#4535403

0 comments: