cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping server Time

Former Member
0 Kudos

Hi,

I am doing a xslt mapping, i need to mark a field with the server Time of xi server, any lights on this?

Regards,

Anirban.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anirban,

Try this:

<Date_Time>

<date>

<xsl:value-of select="current-date()"/>

</date>

<time>

<xsl:value-of select="current-time()"/>

</time>

</Date_Time>

Use the substring function to get the format which you require.

Regards,

Anish

Answers (7)

Answers (7)

former_member189519
Participant
0 Kudos

the graphical mapping function "currentDate" also gets hours, minutes and seconds

for the syntax use "yyyy/MM/dd hh:mm:ss" and you see

i am on SP15

Former Member
0 Kudos

Hi,

The below code could be of some use...

<b><?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myjava="java.util.Calendar">

<xsl:template>

<date>

<xsl:value-of select="myjava:HOUR_OF_DAY"/><xsl:value-of select="myjava:MINUTE"/><xsl:value-of select="myjava:SECOND"/>

</date>

</xsl:template>

</xsl:stylesheet></b>

Regards,

KNS Kumar.

Former Member
0 Kudos

Hi Anirban,

i think u dont have a fucntion to get the current time of the server directly in XSLT.you need to write a user defined function in java to get the current time and call that java function in XSLT.

u can try this code for getting time

SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss a z");

Date now = new Date();

String nowAsString = formatter.format(now);

if u run it in ur XI server u will get the server time.

for calling java functions in XSLT chk out this link

regards

jithesh

Former Member
0 Kudos

Hi Anirban,

you can use Java functions inside your xslt mapping. The function should be static.

Try to use this weblog. This will fulfill your requirement.

/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners

Regards

Vishal Kumar

former_member187339
Active Contributor
0 Kudos

Hi,

Try calling this function : <b>date:date-time()</b>. It will return <i>Returns the current date and time</i>

For more info click here <a href="http://www.w3.org/TR/xpath-functions/#func-current-dateTime">here</a>

Regards

Suraj

Former Member
0 Kudos

Hi Anirban,

You can use user defined function in Java and use the standard fuction available in java to capture the server time and date.

Thanks,

Prateek

Former Member
0 Kudos

Hi Vijaya/Prateek,

You all talking of JCO calls, right?

1.Anyways of doing without java?

2.Java code snippet for this functionality? any weblog etc?

Regards,

Anirban.

Former Member
0 Kudos

Hi Anirban,

Yo can write a user defined function to get the server time.

Regards

vijaya